clang 17.0.6
Sema.h
Go to the documentation of this file.
1//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the Sema class, which performs semantic analysis and
10// builds ASTs.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMA_H
15#define LLVM_CLANG_SEMA_SEMA_H
16
18#include "clang/AST/ASTFwd.h"
19#include "clang/AST/Attr.h"
24#include "clang/AST/Expr.h"
25#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
32#include "clang/AST/NSAPI.h"
34#include "clang/AST/StmtCXX.h"
36#include "clang/AST/TypeLoc.h"
42#include "clang/Basic/Module.h"
51#include "clang/Sema/DeclSpec.h"
56#include "clang/Sema/Scope.h"
59#include "clang/Sema/Weak.h"
60#include "llvm/ADT/ArrayRef.h"
61#include "llvm/ADT/SetVector.h"
62#include "llvm/ADT/SmallBitVector.h"
63#include "llvm/ADT/SmallPtrSet.h"
64#include "llvm/ADT/SmallSet.h"
65#include "llvm/ADT/SmallVector.h"
66#include "llvm/ADT/TinyPtrVector.h"
67#include "llvm/Frontend/OpenMP/OMPConstants.h"
68#include <deque>
69#include <memory>
70#include <optional>
71#include <string>
72#include <tuple>
73#include <vector>
74
75namespace llvm {
76 class APSInt;
77 template <typename ValueT, typename ValueInfoT> class DenseSet;
78 class SmallBitVector;
79 struct InlineAsmIdentifierInfo;
80}
81
82namespace clang {
83 class ADLResult;
84 class ASTConsumer;
85 class ASTContext;
86 class ASTMutationListener;
87 class ASTReader;
88 class ASTWriter;
89 class ArrayType;
90 class ParsedAttr;
91 class BindingDecl;
92 class BlockDecl;
93 class CapturedDecl;
94 class CXXBasePath;
95 class CXXBasePaths;
96 class CXXBindTemporaryExpr;
98 class CXXConstructorDecl;
99 class CXXConversionDecl;
100 class CXXDeleteExpr;
101 class CXXDestructorDecl;
102 class CXXFieldCollector;
103 class CXXMemberCallExpr;
104 class CXXMethodDecl;
105 class CXXScopeSpec;
106 class CXXTemporary;
107 class CXXTryStmt;
108 class CallExpr;
109 class ClassTemplateDecl;
110 class ClassTemplatePartialSpecializationDecl;
111 class ClassTemplateSpecializationDecl;
112 class VarTemplatePartialSpecializationDecl;
113 class CodeCompleteConsumer;
114 class CodeCompletionAllocator;
115 class CodeCompletionTUInfo;
116 class CodeCompletionResult;
117 class CoroutineBodyStmt;
118 class Decl;
119 class DeclAccessPair;
120 class DeclContext;
121 class DeclRefExpr;
122 class DeclaratorDecl;
123 class DeducedTemplateArgument;
124 class DependentDiagnostic;
125 class DesignatedInitExpr;
126 class Designation;
127 class EnableIfAttr;
128 class EnumConstantDecl;
129 class Expr;
130 class ExtVectorType;
131 class FormatAttr;
132 class FriendDecl;
133 class FunctionDecl;
134 class FunctionProtoType;
135 class FunctionTemplateDecl;
136 class ImplicitConversionSequence;
138 class InitListExpr;
139 class InitializationKind;
140 class InitializationSequence;
141 class InitializedEntity;
142 class IntegerLiteral;
143 class LabelStmt;
144 class LambdaExpr;
145 class LangOptions;
146 class LocalInstantiationScope;
147 class LookupResult;
148 class MacroInfo;
150 class ModuleLoader;
151 class MultiLevelTemplateArgumentList;
152 class NamedDecl;
153 class ObjCCategoryDecl;
154 class ObjCCategoryImplDecl;
155 class ObjCCompatibleAliasDecl;
156 class ObjCContainerDecl;
157 class ObjCImplDecl;
158 class ObjCImplementationDecl;
159 class ObjCInterfaceDecl;
160 class ObjCIvarDecl;
161 template <class T> class ObjCList;
162 class ObjCMessageExpr;
163 class ObjCMethodDecl;
164 class ObjCPropertyDecl;
165 class ObjCProtocolDecl;
167 class OMPRequiresDecl;
169 class OMPDeclareSimdDecl;
170 class OMPClause;
171 struct OMPVarListLocTy;
172 struct OverloadCandidate;
173 enum class OverloadCandidateParamOrder : char;
176 class OverloadExpr;
177 class ParenListExpr;
178 class ParmVarDecl;
179 class Preprocessor;
181 class PseudoObjectExpr;
182 class QualType;
184 class Stmt;
185 class StringLiteral;
186 class SwitchStmt;
187 class TemplateArgument;
190 class TemplateDecl;
195 class Token;
196 class TypeAliasDecl;
197 class TypedefDecl;
198 class TypedefNameDecl;
199 class TypeLoc;
201 class UnqualifiedId;
204 class UnresolvedSetImpl;
206 class UsingDecl;
207 class UsingShadowDecl;
208 class ValueDecl;
209 class VarDecl;
211 class VisibilityAttr;
213 class IndirectFieldDecl;
216
217namespace sema {
218 class AccessedEntity;
219 class BlockScopeInfo;
220 class Capture;
222 class CapturingScopeInfo;
223 class CompoundScopeInfo;
224 class DelayedDiagnostic;
226 class FunctionScopeInfo;
227 class LambdaScopeInfo;
230 class SemaPPCallbacks;
232}
233
234namespace threadSafety {
235 class BeforeSet;
236 void threadSafetyCleanup(BeforeSet* Cache);
237}
238
239// FIXME: No way to easily map from TemplateTypeParmTypes to
240// TemplateTypeParmDecls, so we have this horrible PointerUnion.
241typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType *, NamedDecl *>,
242 SourceLocation>
244
245/// Describes whether we've seen any nullability information for the given
246/// file.
248 /// The first pointer declarator (of any pointer kind) in the file that does
249 /// not have a corresponding nullability annotation.
251
252 /// The end location for the first pointer declarator in the file. Used for
253 /// placing fix-its.
255
256 /// Which kind of pointer declarator we saw.
257 uint8_t PointerKind;
258
259 /// Whether we saw any type nullability annotations in the given file.
260 bool SawTypeNullability = false;
261};
262
263/// A mapping from file IDs to a record of whether we've seen nullability
264/// information in that file.
266 /// A mapping from file IDs to the nullability information for each file ID.
267 llvm::DenseMap<FileID, FileNullability> Map;
268
269 /// A single-element cache based on the file ID.
270 struct {
273 } Cache;
274
275public:
277 // Check the single-element cache.
278 if (file == Cache.File)
279 return Cache.Nullability;
280
281 // It's not in the single-element cache; flush the cache if we have one.
282 if (!Cache.File.isInvalid()) {
283 Map[Cache.File] = Cache.Nullability;
284 }
285
286 // Pull this entry into the cache.
287 Cache.File = file;
288 Cache.Nullability = Map[file];
289 return Cache.Nullability;
290 }
291};
292
293/// Tracks expected type during expression parsing, for use in code completion.
294/// The type is tied to a particular token, all functions that update or consume
295/// the type take a start location of the token they are looking at as a
296/// parameter. This avoids updating the type on hot paths in the parser.
298public:
299 PreferredTypeBuilder(bool Enabled) : Enabled(Enabled) {}
300
304 /// Handles e.g. BaseType{ .D = Tok...
306 const Designation &D);
307 /// Computing a type for the function argument may require running
308 /// overloading, so we postpone its computation until it is actually needed.
309 ///
310 /// Clients should be very careful when using this function, as it stores a
311 /// function_ref, clients should make sure all calls to get() with the same
312 /// location happen while function_ref is alive.
313 ///
314 /// The callback should also emit signature help as a side-effect, but only
315 /// if the completion point has been reached.
317 llvm::function_ref<QualType()> ComputeType);
318
321 SourceLocation OpLoc);
324 void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS);
325 /// Handles all type casts, including C-style cast, C++ casts, etc.
327
328 /// Get the expected type associated with this location, if any.
329 ///
330 /// If the location is a function argument, determining the expected type
331 /// involves considering all function overloads and the arguments so far.
332 /// In this case, signature help for these function overloads will be reported
333 /// as a side-effect (only if the completion point has been reached).
335 if (!Enabled || Tok != ExpectedLoc)
336 return QualType();
337 if (!Type.isNull())
338 return Type;
339 if (ComputeType)
340 return ComputeType();
341 return QualType();
342 }
343
344private:
345 bool Enabled;
346 /// Start position of a token for which we store expected type.
347 SourceLocation ExpectedLoc;
348 /// Expected type for a token starting at ExpectedLoc.
350 /// A function to compute expected type at ExpectedLoc. It is only considered
351 /// if Type is null.
352 llvm::function_ref<QualType()> ComputeType;
353};
354
355/// Sema - This implements semantic analysis and AST building for C.
356class Sema final {
357 Sema(const Sema &) = delete;
358 void operator=(const Sema &) = delete;
359
360 ///Source of additional semantic information.
362
363 static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
364
365 /// Determine whether two declarations should be linked together, given that
366 /// the old declaration might not be visible and the new declaration might
367 /// not have external linkage.
368 bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
369 const NamedDecl *New) {
370 if (isVisible(Old))
371 return true;
372 // See comment in below overload for why it's safe to compute the linkage
373 // of the new declaration here.
374 if (New->isExternallyDeclarable()) {
375 assert(Old->isExternallyDeclarable() &&
376 "should not have found a non-externally-declarable previous decl");
377 return true;
378 }
379 return false;
380 }
381 bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
382
383 void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
384 QualType ResultTy,
385 ArrayRef<QualType> Args);
386
387public:
388 /// The maximum alignment, same as in llvm::Value. We duplicate them here
389 /// because that allows us not to duplicate the constants in clang code,
390 /// which we must to since we can't directly use the llvm constants.
391 /// The value is verified against llvm here: lib/CodeGen/CGDecl.cpp
392 ///
393 /// This is the greatest alignment value supported by load, store, and alloca
394 /// instructions, and global values.
395 static const unsigned MaxAlignmentExponent = 32;
396 static const uint64_t MaximumAlignment = 1ull << MaxAlignmentExponent;
397
401
404
411
412 /// Flag indicating whether or not to collect detailed statistics.
414
415 /// Code-completion consumer.
417
418 /// CurContext - This is the current declaration context of parsing.
420
421 /// Generally null except when we temporarily switch decl contexts,
422 /// like in \see ActOnObjCTemporaryExitContainerContext.
424
425 /// VAListTagName - The declaration name corresponding to __va_list_tag.
426 /// This is used as part of a hack to omit that class from ADL results.
428
429 bool MSStructPragmaOn; // True when \#pragma ms_struct on
430
431 /// Controls member pointer representation format under the MS ABI.
434
435 /// Stack of active SEH __finally scopes. Can be empty.
437
438 /// Source location for newly created implicit MSInheritanceAttrs
440
441 /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
442 /// `TransformTypos` in order to keep track of any TypoExprs that are created
443 /// recursively during typo correction and wipe them away if the correction
444 /// fails.
446
447 /// pragma clang section kind
456
461
467
473
475 PSK_Reset = 0x0, // #pragma ()
476 PSK_Set = 0x1, // #pragma (value)
477 PSK_Push = 0x2, // #pragma (push[, id])
478 PSK_Pop = 0x4, // #pragma (pop[, id])
479 PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
480 PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
481 PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
482 };
483
489
490 // #pragma pack and align.
492 public:
493 // `Native` represents default align mode, which may vary based on the
494 // platform.
495 enum Mode : unsigned char { Native, Natural, Packed, Mac68k };
496
497 // #pragma pack info constructor
498 AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
499 : PackAttr(true), AlignMode(M), PackNumber(Num), XLStack(IsXL) {
500 assert(Num == PackNumber && "The pack number has been truncated.");
501 }
502
503 // #pragma align info constructor
505 : PackAttr(false), AlignMode(M),
506 PackNumber(M == Packed ? 1 : UninitPackVal), XLStack(IsXL) {}
507
508 explicit AlignPackInfo(bool IsXL) : AlignPackInfo(Native, IsXL) {}
509
511
512 // When a AlignPackInfo itself cannot be used, this returns an 32-bit
513 // integer encoding for it. This should only be passed to
514 // AlignPackInfo::getFromRawEncoding, it should not be inspected directly.
515 static uint32_t getRawEncoding(const AlignPackInfo &Info) {
516 std::uint32_t Encoding{};
517 if (Info.IsXLStack())
518 Encoding |= IsXLMask;
519
520 Encoding |= static_cast<uint32_t>(Info.getAlignMode()) << 1;
521
522 if (Info.IsPackAttr())
523 Encoding |= PackAttrMask;
524
525 Encoding |= static_cast<uint32_t>(Info.getPackNumber()) << 4;
526
527 return Encoding;
528 }
529
530 static AlignPackInfo getFromRawEncoding(unsigned Encoding) {
531 bool IsXL = static_cast<bool>(Encoding & IsXLMask);
533 static_cast<AlignPackInfo::Mode>((Encoding & AlignModeMask) >> 1);
534 int PackNumber = (Encoding & PackNumMask) >> 4;
535
536 if (Encoding & PackAttrMask)
537 return AlignPackInfo(M, PackNumber, IsXL);
538
539 return AlignPackInfo(M, IsXL);
540 }
541
542 bool IsPackAttr() const { return PackAttr; }
543
544 bool IsAlignAttr() const { return !PackAttr; }
545
546 Mode getAlignMode() const { return AlignMode; }
547
548 unsigned getPackNumber() const { return PackNumber; }
549
550 bool IsPackSet() const {
551 // #pragma align, #pragma pack(), and #pragma pack(0) do not set the pack
552 // attriute on a decl.
553 return PackNumber != UninitPackVal && PackNumber != 0;
554 }
555
556 bool IsXLStack() const { return XLStack; }
557
558 bool operator==(const AlignPackInfo &Info) const {
559 return std::tie(AlignMode, PackNumber, PackAttr, XLStack) ==
560 std::tie(Info.AlignMode, Info.PackNumber, Info.PackAttr,
561 Info.XLStack);
562 }
563
564 bool operator!=(const AlignPackInfo &Info) const {
565 return !(*this == Info);
566 }
567
568 private:
569 /// \brief True if this is a pragma pack attribute,
570 /// not a pragma align attribute.
571 bool PackAttr;
572
573 /// \brief The alignment mode that is in effect.
574 Mode AlignMode;
575
576 /// \brief The pack number of the stack.
577 unsigned char PackNumber;
578
579 /// \brief True if it is a XL #pragma align/pack stack.
580 bool XLStack;
581
582 /// \brief Uninitialized pack value.
583 static constexpr unsigned char UninitPackVal = -1;
584
585 // Masks to encode and decode an AlignPackInfo.
586 static constexpr uint32_t IsXLMask{0x0000'0001};
587 static constexpr uint32_t AlignModeMask{0x0000'0006};
588 static constexpr uint32_t PackAttrMask{0x00000'0008};
589 static constexpr uint32_t PackNumMask{0x0000'01F0};
590 };
591
592 template<typename ValueType>
593 struct PragmaStack {
605
606 void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action,
607 llvm::StringRef StackSlotLabel, ValueType Value) {
608 if (Action == PSK_Reset) {
610 CurrentPragmaLocation = PragmaLocation;
611 return;
612 }
613 if (Action & PSK_Push)
614 Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
615 PragmaLocation);
616 else if (Action & PSK_Pop) {
617 if (!StackSlotLabel.empty()) {
618 // If we've got a label, try to find it and jump there.
619 auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
620 return x.StackSlotLabel == StackSlotLabel;
621 });
622 // If we found the label so pop from there.
623 if (I != Stack.rend()) {
624 CurrentValue = I->Value;
625 CurrentPragmaLocation = I->PragmaLocation;
626 Stack.erase(std::prev(I.base()), Stack.end());
627 }
628 } else if (!Stack.empty()) {
629 // We do not have a label, just pop the last entry.
630 CurrentValue = Stack.back().Value;
631 CurrentPragmaLocation = Stack.back().PragmaLocation;
632 Stack.pop_back();
633 }
634 }
635 if (Action & PSK_Set) {
637 CurrentPragmaLocation = PragmaLocation;
638 }
639 }
640
641 // MSVC seems to add artificial slots to #pragma stacks on entering a C++
642 // method body to restore the stacks on exit, so it works like this:
643 //
644 // struct S {
645 // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
646 // void Method {}
647 // #pragma <name>(pop, InternalPragmaSlot)
648 // };
649 //
650 // It works even with #pragma vtordisp, although MSVC doesn't support
651 // #pragma vtordisp(push [, id], n)
652 // syntax.
653 //
654 // Push / pop a named sentinel slot.
655 void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
656 assert((Action == PSK_Push || Action == PSK_Pop) &&
657 "Can only push / pop #pragma stack sentinels!");
659 }
660
661 // Constructors.
662 explicit PragmaStack(const ValueType &Default)
664
665 bool hasValue() const { return CurrentValue != DefaultValue; }
666
668 ValueType DefaultValue; // Value used for PSK_Reset action.
669 ValueType CurrentValue;
671 };
672 // FIXME: We should serialize / deserialize these if they occur in a PCH (but
673 // we shouldn't do so if they're in a module).
674
675 /// Whether to insert vtordisps prior to virtual bases in the Microsoft
676 /// C++ ABI. Possible values are 0, 1, and 2, which mean:
677 ///
678 /// 0: Suppress all vtordisps
679 /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
680 /// structors
681 /// 2: Always insert vtordisps to support RTTI on partially constructed
682 /// objects
685 // The current #pragma align/pack values and locations at each #include.
692 // Segment #pragmas.
697
698 // #pragma strict_gs_check.
700
701 // This stack tracks the current state of Sema.CurFPFeatures.
704 FPOptionsOverride result;
705 if (!FpPragmaStack.hasValue()) {
706 result = FPOptionsOverride();
707 } else {
708 result = FpPragmaStack.CurrentValue;
709 }
710 return result;
711 }
712
713 // Saves the current floating-point pragma stack and clear it in this Sema.
715 public:
717 : S(S), SavedStack(std::move(S.FpPragmaStack)) {
718 S.FpPragmaStack.Stack.clear();
719 }
720 ~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); }
721
722 private:
723 Sema &S;
725 };
726
728 CurFPFeatures = FPO;
729 FpPragmaStack.CurrentValue = FPO.getChangesFrom(FPOptions(LangOpts));
730 }
731
732 // RAII object to push / pop sentinel slots for all MS #pragma stacks.
733 // Actions should be performed only if we enter / exit a C++ method body.
735 public:
736 PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
738
739 private:
740 Sema &S;
741 StringRef SlotLabel;
742 bool ShouldAct;
743 };
744
745 /// A mapping that describes the nullability we've seen in each header file.
747
748 /// Last section used with #pragma init_seg.
751
752 /// Sections used with #pragma alloc_text.
753 llvm::StringMap<std::tuple<StringRef, SourceLocation>> FunctionToSectionMap;
754
755 /// VisContext - Manages the stack for \#pragma GCC visibility.
756 void *VisContext; // Really a "PragmaVisStack*"
757
758 /// This an attribute introduced by \#pragma clang attribute.
765
766 /// A push'd group of PragmaAttributeEntries.
768 /// The location of the push attribute.
770 /// The namespace of this push group.
773 };
774
776
777 /// The declaration that is currently receiving an attribute from the
778 /// #pragma attribute stack.
780
781 /// This represents the last location of a "#pragma clang optimize off"
782 /// directive if such a directive has not been closed by an "on" yet. If
783 /// optimizations are currently "on", this is set to an invalid location.
785
786 /// The "on" or "off" argument passed by \#pragma optimize, that denotes
787 /// whether the optimizations in the list passed to the pragma should be
788 /// turned off or on. This boolean is true by default because command line
789 /// options are honored when `#pragma optimize("", on)`.
790 /// (i.e. `ModifyFnAttributeMSPragmaOptimze()` does nothing)
792
793 /// Set of no-builtin functions listed by \#pragma function.
795
796 /// Flag indicating if Sema is building a recovery call expression.
797 ///
798 /// This flag is used to avoid building recovery call expressions
799 /// if Sema is already doing so, which would cause infinite recursions.
801
802 /// Used to control the generation of ExprWithCleanups.
804
805 /// ExprCleanupObjects - This is the stack of objects requiring
806 /// cleanup that are created by the current full expression.
808
809 /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
810 /// to a variable (constant) that may or may not be odr-used in this Expr, and
811 /// we won't know until all lvalue-to-rvalue and discarded value conversions
812 /// have been applied to all subexpressions of the enclosing full expression.
813 /// This is cleared at the end of each full expression.
816
817 std::unique_ptr<sema::FunctionScopeInfo> CachedFunctionScope;
818
819 /// Stack containing information about each of the nested
820 /// function, block, and method scopes that are currently active.
822
823 /// The index of the first FunctionScope that corresponds to the current
824 /// context.
826
827 /// Track the number of currently active capturing scopes.
829
834
835 /// Stack containing information needed when in C++2a an 'auto' is encountered
836 /// in a function declaration parameter type specifier in order to invent a
837 /// corresponding template parameter in the enclosing abbreviated function
838 /// template. This information is also present in LambdaScopeInfo, stored in
839 /// the FunctionScopes stack.
841
842 /// The index of the first InventedParameterInfo that refers to the current
843 /// context.
845
851
855
856 /// ExtVectorDecls - This is a list all the extended vector types. This allows
857 /// us to associate a raw vector type with one of the ext_vector type names.
858 /// This is only necessary for issuing pretty diagnostics.
860
861 /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
862 std::unique_ptr<CXXFieldCollector> FieldCollector;
863
865
866 /// Set containing all declared private fields that are not used.
868
869 /// Set containing all typedefs that are likely unused.
872
873 /// Delete-expressions to be analyzed at the end of translation unit
874 ///
875 /// This list contains class members, and locations of delete-expressions
876 /// that could not be proven as to whether they mismatch with new-expression
877 /// used in initializer of the field.
878 typedef std::pair<SourceLocation, bool> DeleteExprLoc;
880 llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
881
883
884 /// PureVirtualClassDiagSet - a set of class declarations which we have
885 /// emitted a list of pure virtual functions. Used to prevent emitting the
886 /// same list more than once.
887 std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
888
889 /// ParsingInitForAutoVars - a set of declarations with auto types for which
890 /// we are currently parsing the initializer.
892
893 /// Look for a locally scoped extern "C" declaration by the given name.
895
899
900 /// All the tentative definitions encountered in the TU.
902
903 /// All the external declarations encoutered and used in the TU.
905
909
910 /// The set of file scoped decls seen so far that have not been used
911 /// and must warn if not used. Only contains the first declaration.
913
917
918 /// All the delegating constructors seen so far in the file, used for
919 /// cycle detection at the end of the TU.
921
922 /// All the overriding functions seen during a class definition
923 /// that had their exception spec checks delayed, plus the overridden
924 /// function.
927
928 /// All the function redeclarations seen during a class definition that had
929 /// their exception spec checks delayed, plus the prior declaration they
930 /// should be checked against. Except during error recovery, the new decl
931 /// should always be a friend declaration, as that's the only valid way to
932 /// redeclare a special member before its class is complete.
935
936 typedef llvm::MapVector<const FunctionDecl *,
937 std::unique_ptr<LateParsedTemplate>>
940
941 /// Callback to the parser to parse templated functions when needed.
942 typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
943 typedef void LateTemplateParserCleanupCB(void *P);
947
949 LateTemplateParserCleanupCB *LTPCleanup,
950 void *P) {
951 LateTemplateParser = LTP;
952 LateTemplateParserCleanup = LTPCleanup;
953 OpaqueParser = P;
954 }
955
956 class DelayedDiagnostics;
957
959 sema::DelayedDiagnosticPool *SavedPool = nullptr;
961 };
964
965 /// A class which encapsulates the logic for delaying diagnostics
966 /// during parsing and other processing.
968 /// The current pool of diagnostics into which delayed
969 /// diagnostics should go.
970 sema::DelayedDiagnosticPool *CurPool = nullptr;
971
972 public:
974
975 /// Adds a delayed diagnostic.
976 void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
977
978 /// Determines whether diagnostics should be delayed.
979 bool shouldDelayDiagnostics() { return CurPool != nullptr; }
980
981 /// Returns the current delayed-diagnostics pool.
983 return CurPool;
984 }
985
986 /// Enter a new scope. Access and deprecation diagnostics will be
987 /// collected in this pool.
990 state.SavedPool = CurPool;
991 CurPool = &pool;
992 return state;
993 }
994
995 /// Leave a delayed-diagnostic state that was previously pushed.
996 /// Do not emit any of the diagnostics. This is performed as part
997 /// of the bookkeeping of popping a pool "properly".
999 CurPool = state.SavedPool;
1000 }
1001
1002 /// Enter a new scope where access and deprecation diagnostics are
1003 /// not delayed.
1006 state.SavedPool = CurPool;
1007 CurPool = nullptr;
1008 return state;
1009 }
1010
1011 /// Undo a previous pushUndelayed().
1013 assert(CurPool == nullptr);
1014 CurPool = state.SavedPool;
1015 }
1017
1018 /// A RAII object to temporarily push a declaration context.
1020 private:
1021 Sema &S;
1022 DeclContext *SavedContext;
1023 ProcessingContextState SavedContextState;
1024 QualType SavedCXXThisTypeOverride;
1025 unsigned SavedFunctionScopesStart;
1026 unsigned SavedInventedParameterInfosStart;
1027
1028 public:
1029 ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
1030 : S(S), SavedContext(S.CurContext),
1031 SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
1032 SavedCXXThisTypeOverride(S.CXXThisTypeOverride),
1033 SavedFunctionScopesStart(S.FunctionScopesStart),
1034 SavedInventedParameterInfosStart(S.InventedParameterInfosStart)
1035 {
1036 assert(ContextToPush && "pushing null context");
1037 S.CurContext = ContextToPush;
1038 if (NewThisContext)
1039 S.CXXThisTypeOverride = QualType();
1040 // Any saved FunctionScopes do not refer to this context.
1041 S.FunctionScopesStart = S.FunctionScopes.size();
1042 S.InventedParameterInfosStart = S.InventedParameterInfos.size();
1043 }
1044
1045 void pop() {
1046 if (!SavedContext) return;
1047 S.CurContext = SavedContext;
1048 S.DelayedDiagnostics.popUndelayed(SavedContextState);
1049 S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
1050 S.FunctionScopesStart = SavedFunctionScopesStart;
1051 S.InventedParameterInfosStart = SavedInventedParameterInfosStart;
1052 SavedContext = nullptr;
1053 }
1054
1056 pop();
1057 }
1058 };
1059
1060 /// Whether the AST is currently being rebuilt to correct immediate
1061 /// invocations. Immediate invocation candidates and references to consteval
1062 /// functions aren't tracked when this is set.
1064
1065 /// Used to change context to isConstantEvaluated without pushing a heavy
1066 /// ExpressionEvaluationContextRecord object.
1068
1069 bool isConstantEvaluated() const {
1070 return ExprEvalContexts.back().isConstantEvaluated() ||
1072 }
1073
1074 /// RAII object to handle the state changes required to synthesize
1075 /// a function body.
1077 Sema &S;
1078 Sema::ContextRAII SavedContext;
1079 bool PushedCodeSynthesisContext = false;
1080
1081 public:
1083 : S(S), SavedContext(S, DC) {
1084 auto *FD = dyn_cast<FunctionDecl>(DC);
1085 S.PushFunctionScope();
1086 S.PushExpressionEvaluationContext(
1087 (FD && FD->isConsteval())
1090 if (FD) {
1091 FD->setWillHaveBody(true);
1092 S.ExprEvalContexts.back().InImmediateFunctionContext =
1093 FD->isImmediateFunction();
1094 S.ExprEvalContexts.back().InImmediateEscalatingFunctionContext =
1095 S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
1096 } else
1097 assert(isa<ObjCMethodDecl>(DC));
1098 }
1099
1101 assert(!PushedCodeSynthesisContext);
1102
1105 Ctx.PointOfInstantiation = UseLoc;
1106 Ctx.Entity = cast<Decl>(S.CurContext);
1107 S.pushCodeSynthesisContext(Ctx);
1108
1109 PushedCodeSynthesisContext = true;
1110 }
1111
1113 if (PushedCodeSynthesisContext)
1114 S.popCodeSynthesisContext();
1115 if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext)) {
1116 FD->setWillHaveBody(false);
1117 S.CheckImmediateEscalatingFunctionDefinition(FD, S.getCurFunction());
1118 }
1119 S.PopExpressionEvaluationContext();
1120 S.PopFunctionScopeInfo();
1121 }
1122 };
1123
1124 /// WeakUndeclaredIdentifiers - Identifiers contained in \#pragma weak before
1125 /// declared. Rare. May alias another identifier, declared or undeclared.
1126 ///
1127 /// For aliases, the target identifier is used as a key for eventual
1128 /// processing when the target is declared. For the single-identifier form,
1129 /// the sole identifier is used as the key. Each entry is a `SetVector`
1130 /// (ordered by parse order) of aliases (identified by the alias name) in case
1131 /// of multiple aliases to the same undeclared identifier.
1132 llvm::MapVector<
1134 llvm::SetVector<
1136 llvm::SmallDenseSet<WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly>>>
1138
1139 /// ExtnameUndeclaredIdentifiers - Identifiers contained in
1140 /// \#pragma redefine_extname before declared. Used in Solaris system headers
1141 /// to define functions that occur in multiple standards to call the version
1142 /// in the currently selected standard.
1143 llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
1144
1145
1146 /// Load weak undeclared identifiers from the external source.
1148
1149 /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
1150 /// \#pragma weak during processing of other Decls.
1151 /// I couldn't figure out a clean way to generate these in-line, so
1152 /// we store them here and handle separately -- which is a hack.
1153 /// It would be best to refactor this.
1155
1157
1158 /// Translation Unit Scope - useful to Objective-C actions that need
1159 /// to lookup file scope declarations in the "ordinary" C decl namespace.
1160 /// For example, user-defined classes, built-in "id" type, etc.
1162
1163 /// The C++ "std" namespace, where the standard library resides.
1165
1166 /// The C++ "std::bad_alloc" class, which is defined by the C++
1167 /// standard library.
1169
1170 /// The C++ "std::align_val_t" enum class, which is defined by the C++
1171 /// standard library.
1173
1174 /// The C++ "std::initializer_list" template, which is defined in
1175 /// <initializer_list>.
1177
1178 /// The C++ "std::coroutine_traits" template, which is defined in
1179 /// <coroutine_traits>
1181
1182 /// The C++ "type_info" declaration, which is defined in <typeinfo>.
1184
1185 /// The C++ "std::source_location::__impl" struct, defined in
1186 /// <source_location>.
1188
1189 /// Caches identifiers/selectors for NSFoundation APIs.
1190 std::unique_ptr<NSAPI> NSAPIObj;
1191
1192 /// The declaration of the Objective-C NSNumber class.
1194
1195 /// The declaration of the Objective-C NSValue class.
1197
1198 /// Pointer to NSNumber type (NSNumber *).
1200
1201 /// Pointer to NSValue type (NSValue *).
1203
1204 /// The Objective-C NSNumber methods used to create NSNumber literals.
1206
1207 /// The declaration of the Objective-C NSString class.
1209
1210 /// Pointer to NSString type (NSString *).
1212
1213 /// The declaration of the stringWithUTF8String: method.
1215
1216 /// The declaration of the valueWithBytes:objCType: method.
1218
1219 /// The declaration of the Objective-C NSArray class.
1221
1222 /// The declaration of the arrayWithObjects:count: method.
1224
1225 /// The declaration of the Objective-C NSDictionary class.
1227
1228 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
1230
1231 /// id<NSCopying> type.
1233
1234 /// will hold 'respondsToSelector:'
1236
1237 /// A flag to remember whether the implicit forms of operator new and delete
1238 /// have been declared.
1240
1241 /// Describes how the expressions currently being parsed are
1242 /// evaluated at run-time, if at all.
1244 /// The current expression and its subexpressions occur within an
1245 /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
1246 /// \c sizeof, where the type of the expression may be significant but
1247 /// no code will be generated to evaluate the value of the expression at
1248 /// run time.
1250
1251 /// The current expression occurs within a braced-init-list within
1252 /// an unevaluated operand. This is mostly like a regular unevaluated
1253 /// context, except that we still instantiate constexpr functions that are
1254 /// referenced here so that we can perform narrowing checks correctly.
1256
1257 /// The current expression occurs within a discarded statement.
1258 /// This behaves largely similarly to an unevaluated operand in preventing
1259 /// definitions from being required, but not in other ways.
1261
1262 /// The current expression occurs within an unevaluated
1263 /// operand that unconditionally permits abstract references to
1264 /// fields, such as a SIZE operator in MS-style inline assembly.
1266
1267 /// The current context is "potentially evaluated" in C++11 terms,
1268 /// but the expression is evaluated at compile-time (like the values of
1269 /// cases in a switch statement).
1271
1272 /// In addition of being constant evaluated, the current expression
1273 /// occurs in an immediate function context - either a consteval function
1274 /// or a consteval if statement.
1276
1277 /// The current expression is potentially evaluated at run time,
1278 /// which means that code may be generated to evaluate the value of the
1279 /// expression at run time.
1281
1282 /// The current expression is potentially evaluated, but any
1283 /// declarations referenced inside that expression are only used if
1284 /// in fact the current expression is used.
1285 ///
1286 /// This value is used when parsing default function arguments, for which
1287 /// we would like to provide diagnostics (e.g., passing non-POD arguments
1288 /// through varargs) but do not want to mark declarations as "referenced"
1289 /// until the default argument is used.
1291 };
1292
1293 using ImmediateInvocationCandidate = llvm::PointerIntPair<ConstantExpr *, 1>;
1294
1295 /// Data structure used to record current or nested
1296 /// expression evaluation contexts.
1298 /// The expression evaluation context.
1300
1301 /// Whether the enclosing context needed a cleanup.
1303
1304 /// The number of active cleanup objects when we entered
1305 /// this expression evaluation context.
1307
1308 /// The number of typos encountered during this expression evaluation
1309 /// context (i.e. the number of TypoExprs created).
1310 unsigned NumTypos;
1311
1313
1314 /// The lambdas that are present within this context, if it
1315 /// is indeed an unevaluated context.
1317
1318 /// The declaration that provides context for lambda expressions
1319 /// and block literals if the normal declaration context does not
1320 /// suffice, e.g., in a default function argument.
1322
1323 /// If we are processing a decltype type, a set of call expressions
1324 /// for which we have deferred checking the completeness of the return type.
1326
1327 /// If we are processing a decltype type, a set of temporary binding
1328 /// expressions for which we have deferred checking the destructor.
1330
1332
1333 /// Expressions appearing as the LHS of a volatile assignment in this
1334 /// context. We produce a warning for these when popping the context if
1335 /// they are not discarded-value expressions nor unevaluated operands.
1337
1338 /// Set of candidates for starting an immediate invocation.
1340
1341 /// Set of DeclRefExprs referencing a consteval function when used in a
1342 /// context not already known to be immediately invoked.
1344
1345 /// \brief Describes whether we are in an expression constext which we have
1346 /// to handle differently.
1350
1351 // A context can be nested in both a discarded statement context and
1352 // an immediate function context, so they need to be tracked independently.
1356
1358
1359 // When evaluating immediate functions in the initializer of a default
1360 // argument or default member initializer, this is the declaration whose
1361 // default initializer is being evaluated and the location of the call
1362 // or constructor definition.
1366 : Loc(Loc), Decl(Decl), Context(Context) {
1367 assert(Decl && Context && "invalid initialization context");
1368 }
1369
1371 ValueDecl *Decl = nullptr;
1373 };
1374 std::optional<InitializationContext> DelayedDefaultInitializationContext;
1375
1386
1392
1397
1402 // C++23 [expr.const]p14:
1403 // An expression or conversion is in an immediate function
1404 // context if it is potentially evaluated and either:
1405 // * its innermost enclosing non-block scope is a function
1406 // parameter scope of an immediate function, or
1407 // * its enclosing statement is enclosed by the compound-
1408 // statement of a consteval if statement.
1411 }
1412
1419 };
1420
1421 /// A stack of expression evaluation contexts.
1423
1424 // Set of failed immediate invocations to avoid double diagnosing.
1426
1427 /// Emit a warning for all pending noderef expressions that we recorded.
1429
1430 /// Compute the mangling number context for a lambda expression or
1431 /// block literal. Also return the extra mangling decl if any.
1432 ///
1433 /// \param DC - The DeclContext containing the lambda expression or
1434 /// block literal.
1435 std::tuple<MangleNumberingContext *, Decl *>
1437
1438
1439 /// SpecialMemberOverloadResult - The overloading result for a special member
1440 /// function.
1441 ///
1442 /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1443 /// integer are used to determine whether overload resolution succeeded.
1445 public:
1451
1452 private:
1453 llvm::PointerIntPair<CXXMethodDecl *, 2> Pair;
1454
1455 public:
1458 : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1459
1460 CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1461 void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1462
1463 Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1464 void setKind(Kind K) { Pair.setInt(K); }
1465 };
1466
1468 : public llvm::FastFoldingSetNode,
1470 public:
1471 SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1472 : FastFoldingSetNode(ID)
1473 {}
1474 };
1475
1476 /// A cache of special member function overload resolution results
1477 /// for C++ records.
1478 llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1479
1480 /// A cache of the flags available in enumerations with the flag_bits
1481 /// attribute.
1482 mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1483
1484 /// The kind of translation unit we are processing.
1485 ///
1486 /// When we're processing a complete translation unit, Sema will perform
1487 /// end-of-translation-unit semantic tasks (such as creating
1488 /// initializers for tentative definitions in C) once parsing has
1489 /// completed. Modules and precompiled headers perform different kinds of
1490 /// checks.
1492
1493 llvm::BumpPtrAllocator BumpAlloc;
1494
1495 /// The number of SFINAE diagnostics that have been trapped.
1497
1498 typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1500
1501 /// A mapping from parameters with unparsed default arguments to the
1502 /// set of instantiations of each parameter.
1503 ///
1504 /// This mapping is a temporary data structure used when parsing
1505 /// nested class templates or nested classes of class templates,
1506 /// where we might end up instantiating an inner class before the
1507 /// default arguments of its methods have been parsed.
1509
1510 // Contains the locations of the beginning of unparsed default
1511 // argument locations.
1512 llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1513
1514 /// UndefinedInternals - all the used, undefined objects which require a
1515 /// definition in this translation unit.
1516 llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1517
1518 /// Determine if VD, which must be a variable or function, is an external
1519 /// symbol that nonetheless can't be referenced from outside this translation
1520 /// unit because its type has no linkage and it's not extern "C".
1521 bool isExternalWithNoLinkageType(const ValueDecl *VD) const;
1522
1523 /// Obtain a sorted list of functions that are undefined but ODR-used.
1525 SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1526
1527 /// Retrieves list of suspicious delete-expressions that will be checked at
1528 /// the end of translation unit.
1529 const llvm::MapVector<FieldDecl *, DeleteLocs> &
1531
1533 public:
1534 using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
1535 using iterator = llvm::DenseMap<Selector, Lists>::iterator;
1536 iterator begin() { return Methods.begin(); }
1537 iterator end() { return Methods.end(); }
1538 iterator find(Selector Sel) { return Methods.find(Sel); }
1539 std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
1540 return Methods.insert(Val);
1541 }
1542 int count(Selector Sel) const { return Methods.count(Sel); }
1543 bool empty() const { return Methods.empty(); }
1544
1545 private:
1546 llvm::DenseMap<Selector, Lists> Methods;
1547 };
1548
1549 /// Method Pool - allows efficient lookup when typechecking messages to "id".
1550 /// We need to maintain a list, since selectors can have differing signatures
1551 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1552 /// of selectors are "overloaded").
1553 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1554 /// methods inside categories with a particular selector.
1556
1557 /// Method selectors used in a \@selector expression. Used for implementation
1558 /// of -Wselector.
1559 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1560
1561 /// List of SourceLocations where 'self' is implicitly retained inside a
1562 /// block.
1565
1566 /// Kinds of C++ special members.
1576
1577 typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
1579
1580 /// The C++ special members which we are currently in the process of
1581 /// declaring. If this process recursively triggers the declaration of the
1582 /// same special member, we should act as if it is not yet declared.
1584
1585 /// Kinds of defaulted comparison operator functions.
1586 enum class DefaultedComparisonKind : unsigned char {
1587 /// This is not a defaultable comparison operator.
1588 None,
1589 /// This is an operator== that should be implemented as a series of
1590 /// subobject comparisons.
1591 Equal,
1592 /// This is an operator<=> that should be implemented as a series of
1593 /// subobject comparisons.
1594 ThreeWay,
1595 /// This is an operator!= that should be implemented as a rewrite in terms
1596 /// of a == comparison.
1597 NotEqual,
1598 /// This is an <, <=, >, or >= that should be implemented as a rewrite in
1599 /// terms of a <=> comparison.
1600 Relational,
1601 };
1602
1603 /// The function definitions which were renamed as part of typo-correction
1604 /// to match their respective declarations. We want to keep track of them
1605 /// to ensure that we don't emit a "redefinition" error if we encounter a
1606 /// correctly named definition after the renamed definition.
1608
1609 /// Stack of types that correspond to the parameter entities that are
1610 /// currently being copy-initialized. Can be empty.
1612
1613 void ReadMethodPool(Selector Sel);
1615
1616 /// Private Helper predicate to check for 'self'.
1617 bool isSelfExpr(Expr *RExpr);
1618 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1619
1620 /// Cause the active diagnostic on the DiagosticsEngine to be
1621 /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1622 /// should not be used elsewhere.
1623 void EmitCurrentDiagnostic(unsigned DiagID);
1624
1625 /// Records and restores the CurFPFeatures state on entry/exit of compound
1626 /// statements.
1628 public:
1631 FPOptionsOverride getOverrides() { return OldOverrides; }
1632
1633 private:
1634 Sema& S;
1635 FPOptions OldFPFeaturesState;
1636 FPOptionsOverride OldOverrides;
1637 LangOptions::FPEvalMethodKind OldEvalMethod;
1638 SourceLocation OldFPPragmaLocation;
1639 };
1640
1641 void addImplicitTypedef(StringRef Name, QualType T);
1642
1644
1645 /// Increment when we find a reference; decrement when we find an ignored
1646 /// assignment. Ultimately the value is 0 if every reference is an ignored
1647 /// assignment.
1648 llvm::DenseMap<const VarDecl *, int> RefsMinusAssignments;
1649
1650 /// Indicate RISC-V vector builtin functions enabled or not.
1652
1653 /// Indicate RISC-V SiFive vector builtin functions enabled or not.
1655
1656private:
1657 std::unique_ptr<sema::RISCVIntrinsicManager> RVIntrinsicManager;
1658
1659 std::optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
1660
1661 bool WarnedDarwinSDKInfoMissing = false;
1662
1663public:
1664 Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1666 CodeCompleteConsumer *CompletionConsumer = nullptr);
1667 ~Sema();
1668
1669 /// Perform initialization that occurs after the parser has been
1670 /// initialized but before it parses anything.
1671 void Initialize();
1672
1673 /// This virtual key function only exists to limit the emission of debug info
1674 /// describing the Sema class. GCC and Clang only emit debug info for a class
1675 /// with a vtable when the vtable is emitted. Sema is final and not
1676 /// polymorphic, but the debug info size savings are so significant that it is
1677 /// worth adding a vtable just to take advantage of this optimization.
1678 virtual void anchor();
1679
1680 const LangOptions &getLangOpts() const { return LangOpts; }
1683
1686 Preprocessor &getPreprocessor() const { return PP; }
1687 ASTContext &getASTContext() const { return Context; }
1690 ExternalSemaSource *getExternalSource() const { return ExternalSource.get(); }
1691
1693 StringRef Platform);
1695
1696 ///Registers an external source. If an external source already exists,
1697 /// creates a multiplex external source and appends to it.
1698 ///
1699 ///\param[in] E - A non-null external sema source.
1700 ///
1702
1703 void PrintStats() const;
1704
1705 /// Warn that the stack is nearly exhausted.
1707
1708 /// Run some code with "sufficient" stack space. (Currently, at least 256K is
1709 /// guaranteed). Produces a warning if we're low on stack space and allocates
1710 /// more in that case. Use this in code that may recurse deeply (for example,
1711 /// in template instantiation) to avoid stack overflow.
1713 llvm::function_ref<void()> Fn);
1714
1715 /// Helper class that creates diagnostics with optional
1716 /// template instantiation stacks.
1717 ///
1718 /// This class provides a wrapper around the basic DiagnosticBuilder
1719 /// class that emits diagnostics. ImmediateDiagBuilder is
1720 /// responsible for emitting the diagnostic (as DiagnosticBuilder
1721 /// does) and, if the diagnostic comes from inside a template
1722 /// instantiation, printing the template instantiation stack as
1723 /// well.
1725 Sema &SemaRef;
1726 unsigned DiagID;
1727
1728 public:
1729 ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1730 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1731 ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
1732 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1733
1734 // This is a cunning lie. DiagnosticBuilder actually performs move
1735 // construction in its copy constructor (but due to varied uses, it's not
1736 // possible to conveniently express this as actual move construction). So
1737 // the default copy ctor here is fine, because the base class disables the
1738 // source anyway, so the user-defined ~ImmediateDiagBuilder is a safe no-op
1739 // in that case anwyay.
1741
1743 // If we aren't active, there is nothing to do.
1744 if (!isActive()) return;
1745
1746 // Otherwise, we need to emit the diagnostic. First clear the diagnostic
1747 // builder itself so it won't emit the diagnostic in its own destructor.
1748 //
1749 // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1750 // do its own needless checks to see if the diagnostic needs to be
1751 // emitted. However, because we take care to ensure that the builder
1752 // objects never escape, a sufficiently smart compiler will be able to
1753 // eliminate that code.
1754 Clear();
1755
1756 // Dispatch to Sema to emit the diagnostic.
1757 SemaRef.EmitCurrentDiagnostic(DiagID);
1758 }
1759
1760 /// Teach operator<< to produce an object of the correct type.
1761 template <typename T>
1763 operator<<(const ImmediateDiagBuilder &Diag, const T &Value) {
1764 const DiagnosticBuilder &BaseDiag = Diag;
1765 BaseDiag << Value;
1766 return Diag;
1767 }
1768
1769 // It is necessary to limit this to rvalue reference to avoid calling this
1770 // function with a bitfield lvalue argument since non-const reference to
1771 // bitfield is not allowed.
1772 template <typename T,
1773 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
1775 const DiagnosticBuilder &BaseDiag = *this;
1776 BaseDiag << std::move(V);
1777 return *this;
1778 }
1779 };
1780
1781 /// A generic diagnostic builder for errors which may or may not be deferred.
1782 ///
1783 /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
1784 /// which are not allowed to appear inside __device__ functions and are
1785 /// allowed to appear in __host__ __device__ functions only if the host+device
1786 /// function is never codegen'ed.
1787 ///
1788 /// To handle this, we use the notion of "deferred diagnostics", where we
1789 /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
1790 ///
1791 /// This class lets you emit either a regular diagnostic, a deferred
1792 /// diagnostic, or no diagnostic at all, according to an argument you pass to
1793 /// its constructor, thus simplifying the process of creating these "maybe
1794 /// deferred" diagnostics.
1796 public:
1797 enum Kind {
1798 /// Emit no diagnostics.
1800 /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
1802 /// Emit the diagnostic immediately, and, if it's a warning or error, also
1803 /// emit a call stack showing how this function can be reached by an a
1804 /// priori known-emitted function.
1806 /// Create a deferred diagnostic, which is emitted only if the function
1807 /// it's attached to is codegen'ed. Also emit a call stack as with
1808 /// K_ImmediateWithCallStack.
1811
1812 SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID,
1813 const FunctionDecl *Fn, Sema &S);
1816
1817 // The copy and move assignment operator is defined as deleted pending
1818 // further motivation.
1821
1823
1824 bool isImmediate() const { return ImmediateDiag.has_value(); }
1825
1826 /// Convertible to bool: True if we immediately emitted an error, false if
1827 /// we didn't emit an error or we created a deferred error.
1828 ///
1829 /// Example usage:
1830 ///
1831 /// if (SemaDiagnosticBuilder(...) << foo << bar)
1832 /// return ExprError();
1833 ///
1834 /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
1835 /// want to use these instead of creating a SemaDiagnosticBuilder yourself.
1836 operator bool() const { return isImmediate(); }
1837
1838 template <typename T>
1840 operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
1841 if (Diag.ImmediateDiag)
1842 *Diag.ImmediateDiag << Value;
1843 else if (Diag.PartialDiagId)
1844 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
1845 << Value;
1846 return Diag;
1847 }
1848
1849 // It is necessary to limit this to rvalue reference to avoid calling this
1850 // function with a bitfield lvalue argument since non-const reference to
1851 // bitfield is not allowed.
1852 template <typename T,
1853 typename = std::enable_if_t<!std::is_lvalue_reference<T>::value>>
1855 if (ImmediateDiag)
1856 *ImmediateDiag << std::move(V);
1857 else if (PartialDiagId)
1858 S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
1859 return *this;
1860 }
1861
1864 if (Diag.ImmediateDiag)
1865 PD.Emit(*Diag.ImmediateDiag);
1866 else if (Diag.PartialDiagId)
1867 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
1868 return Diag;
1869 }
1870
1871 void AddFixItHint(const FixItHint &Hint) const {
1872 if (ImmediateDiag)
1873 ImmediateDiag->AddFixItHint(Hint);
1874 else if (PartialDiagId)
1875 S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
1876 }
1877
1879 return ExprError();
1880 }
1882 return StmtError();
1883 }
1884 operator ExprResult() const { return ExprError(); }
1885 operator StmtResult() const { return StmtError(); }
1886 operator TypeResult() const { return TypeError(); }
1887 operator DeclResult() const { return DeclResult(true); }
1888 operator MemInitResult() const { return MemInitResult(true); }
1889
1890 private:
1891 Sema &S;
1892 SourceLocation Loc;
1893 unsigned DiagID;
1894 const FunctionDecl *Fn;
1895 bool ShowCallStack;
1896
1897 // Invariant: At most one of these Optionals has a value.
1898 // FIXME: Switch these to a Variant once that exists.
1899 std::optional<ImmediateDiagBuilder> ImmediateDiag;
1900 std::optional<unsigned> PartialDiagId;
1901 };
1902
1903 /// Is the last error level diagnostic immediate. This is used to determined
1904 /// whether the next info diagnostic should be immediate.
1906
1907 /// Emit a diagnostic.
1908 SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID,
1909 bool DeferHint = false);
1910
1911 /// Emit a partial diagnostic.
1913 bool DeferHint = false);
1914
1915 /// Build a partial diagnostic.
1916 PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1917
1918 /// Whether deferrable diagnostics should be deferred.
1919 bool DeferDiags = false;
1920
1921 /// RAII class to control scope of DeferDiags.
1923 Sema &S;
1924 bool SavedDeferDiags = false;
1925
1926 public:
1928 : S(S), SavedDeferDiags(S.DeferDiags) {
1929 S.DeferDiags = DeferDiags;
1930 }
1931 ~DeferDiagsRAII() { S.DeferDiags = SavedDeferDiags; }
1932 };
1933
1934 /// Whether uncompilable error has occurred. This includes error happens
1935 /// in deferred diagnostics.
1936 bool hasUncompilableErrorOccurred() const;
1937
1938 bool findMacroSpelling(SourceLocation &loc, StringRef name);
1939
1940 /// Get a string to suggest for zero-initialization of a type.
1941 std::string
1943 std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1944
1945 /// Calls \c Lexer::getLocForEndOfToken()
1947
1948 /// Retrieve the module loader associated with the preprocessor.
1950
1951 /// Invent a new identifier for parameters of abbreviated templates.
1954 unsigned Index);
1955
1957
1958 private:
1959 /// Function or variable declarations to be checked for whether the deferred
1960 /// diagnostics should be emitted.
1961 llvm::SmallSetVector<Decl *, 4> DeclsToCheckForDeferredDiags;
1962
1963 public:
1964 // Emit all deferred diagnostics.
1965 void emitDeferredDiags();
1966
1968 /// The global module fragment, between 'module;' and a module-declaration.
1970 /// A normal translation unit fragment. For a non-module unit, this is the
1971 /// entire translation unit. Otherwise, it runs from the module-declaration
1972 /// to the private-module-fragment (if any) or the end of the TU (if not).
1974 /// The private module fragment, between 'module :private;' and the end of
1975 /// the translation unit.
1976 Private
1978
1982
1984
1986
1987 void PushFunctionScope();
1988 void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1990
1991 /// This is used to inform Sema what the current TemplateParameterDepth
1992 /// is during Parsing. Currently it is used to pass on the depth
1993 /// when parsing generic lambda 'auto' parameters.
1994 void RecordParsingTemplateParameterDepth(unsigned Depth);
1995
1996 void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1998 unsigned OpenMPCaptureLevel = 0);
1999
2000 /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
2001 /// time after they've been popped.
2003 Sema *Self;
2004
2005 public:
2006 explicit PoppedFunctionScopeDeleter(Sema *Self) : Self(Self) {}
2008 };
2009
2011 std::unique_ptr<sema::FunctionScopeInfo, PoppedFunctionScopeDeleter>;
2012
2015 const Decl *D = nullptr,
2016 QualType BlockType = QualType());
2017
2019 return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
2020 }
2021
2023
2028
2029 void PushCompoundScope(bool IsStmtExpr);
2030 void PopCompoundScope();
2031
2033
2035
2036 /// Retrieve the current block, if any.
2038
2039 /// Get the innermost lambda enclosing the current location, if any. This
2040 /// looks through intervening non-lambda scopes such as local functions and
2041 /// blocks.
2043
2044 /// Retrieve the current lambda scope info, if any.
2045 /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
2046 /// lambda scope info ignoring all inner capturing scopes that are not
2047 /// lambda scopes.
2049 getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
2050
2051 /// Retrieve the current generic lambda info, if any.
2053
2054 /// Retrieve the current captured region, if any.
2056
2057 /// Retrieve the current function, if any, that should be analyzed for
2058 /// potential availability violations.
2060
2061 /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
2063
2064 /// Called before parsing a function declarator belonging to a function
2065 /// declaration.
2067 unsigned TemplateParameterDepth);
2068
2069 /// Called after parsing a function declarator belonging to a function
2070 /// declaration.
2072
2073 void ActOnComment(SourceRange Comment);
2074
2075 //===--------------------------------------------------------------------===//
2076 // Type Analysis / Processing: SemaType.cpp.
2077 //
2078
2080 const DeclSpec *DS = nullptr);
2081 QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
2082 const DeclSpec *DS = nullptr);
2084 SourceLocation Loc, DeclarationName Entity);
2085 QualType BuildReferenceType(QualType T, bool LValueRef,
2086 SourceLocation Loc, DeclarationName Entity);
2088 Expr *ArraySize, unsigned Quals,
2089 SourceRange Brackets, DeclarationName Entity);
2090 QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
2092 SourceLocation AttrLoc);
2093 QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns,
2094 SourceLocation AttrLoc);
2095
2096 QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace,
2097 SourceLocation AttrLoc);
2098
2099 /// Same as above, but constructs the AddressSpace index if not provided.
2101 SourceLocation AttrLoc);
2102
2104
2106
2107 /// Build a function type.
2108 ///
2109 /// This routine checks the function type according to C++ rules and
2110 /// under the assumption that the result type and parameter types have
2111 /// just been instantiated from a template. It therefore duplicates
2112 /// some of the behavior of GetTypeForDeclarator, but in a much
2113 /// simpler form that is only suitable for this narrow use case.
2114 ///
2115 /// \param T The return type of the function.
2116 ///
2117 /// \param ParamTypes The parameter types of the function. This array
2118 /// will be modified to account for adjustments to the types of the
2119 /// function parameters.
2120 ///
2121 /// \param Loc The location of the entity whose type involves this
2122 /// function type or, if there is no such entity, the location of the
2123 /// type that will have function type.
2124 ///
2125 /// \param Entity The name of the entity that involves the function
2126 /// type, if known.
2127 ///
2128 /// \param EPI Extra information about the function type. Usually this will
2129 /// be taken from an existing function with the same prototype.
2130 ///
2131 /// \returns A suitable function type, if there are no errors. The
2132 /// unqualified type will always be a FunctionProtoType.
2133 /// Otherwise, returns a NULL type.
2135 MutableArrayRef<QualType> ParamTypes,
2136 SourceLocation Loc, DeclarationName Entity,
2138
2140 SourceLocation Loc,
2141 DeclarationName Entity);
2143 SourceLocation Loc, DeclarationName Entity);
2147 SourceLocation Loc);
2149 SourceLocation Loc);
2150 QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc);
2151
2154
2155 /// Package the given type and TSI into a ParsedType.
2160 TypeSourceInfo **TInfo = nullptr);
2161 CanThrowResult canThrow(const Stmt *E);
2162 /// Determine whether the callee of a particular function call can throw.
2163 /// E, D and Loc are all optional.
2164 static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
2167 const FunctionProtoType *FPT);
2174 const FunctionProtoType *Old, SourceLocation OldLoc,
2175 const FunctionProtoType *New, SourceLocation NewLoc);
2177 const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
2178 const FunctionProtoType *Old, SourceLocation OldLoc,
2179 const FunctionProtoType *New, SourceLocation NewLoc);
2180 bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
2182 const PartialDiagnostic &NestedDiagID,
2183 const PartialDiagnostic &NoteID,
2184 const PartialDiagnostic &NoThrowDiagID,
2185 const FunctionProtoType *Superset,
2186 SourceLocation SuperLoc,
2187 const FunctionProtoType *Subset,
2188 SourceLocation SubLoc);
2189 bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
2190 const PartialDiagnostic &NoteID,
2191 const FunctionProtoType *Target,
2192 SourceLocation TargetLoc,
2193 const FunctionProtoType *Source,
2194 SourceLocation SourceLoc);
2195
2197
2198 /// The parser has parsed the context-sensitive type 'instancetype'
2199 /// in an Objective-C message declaration. Return the appropriate type.
2201
2202 /// Abstract class used to diagnose incomplete types.
2205
2206 virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
2207 virtual ~TypeDiagnoser() {}
2208 };
2209
2210 static int getPrintable(int I) { return I; }
2211 static unsigned getPrintable(unsigned I) { return I; }
2212 static bool getPrintable(bool B) { return B; }
2213 static const char * getPrintable(const char *S) { return S; }
2214 static StringRef getPrintable(StringRef S) { return S; }
2215 static const std::string &getPrintable(const std::string &S) { return S; }
2216 static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
2217 return II;
2218 }
2220 static QualType getPrintable(QualType T) { return T; }
2221 static SourceRange getPrintable(SourceRange R) { return R; }
2223 static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
2225
2226 template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
2227 protected:
2228 unsigned DiagID;
2229 std::tuple<const Ts &...> Args;
2230
2231 template <std::size_t... Is>
2233 std::index_sequence<Is...>) const {
2234 // Apply all tuple elements to the builder in order.
2235 bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
2236 (void)Dummy;
2237 }
2238
2239 public:
2240 BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
2241 : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
2242 assert(DiagID != 0 && "no diagnostic for type diagnoser");
2243 }
2244
2245 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2246 const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
2247 emit(DB, std::index_sequence_for<Ts...>());
2248 DB << T;
2249 }
2250 };
2251
2252 /// Do a check to make sure \p Name looks like a legal argument for the
2253 /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
2254 /// is invalid for the given declaration.
2255 ///
2256 /// \p AL is used to provide caret diagnostics in case of a malformed name.
2257 ///
2258 /// \returns true if the name is a valid swift name for \p D, false otherwise.
2259 bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc,
2260 const ParsedAttr &AL, bool IsAsync);
2261
2262 /// A derivative of BoundTypeDiagnoser for which the diagnostic's type
2263 /// parameter is preceded by a 0/1 enum that is 1 if the type is sizeless.
2264 /// For example, a diagnostic with no other parameters would generally have
2265 /// the form "...%select{incomplete|sizeless}0 type %1...".
2266 template <typename... Ts>
2268 public:
2269 SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
2270 : BoundTypeDiagnoser<Ts...>(DiagID, Args...) {}
2271
2272 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2273 const SemaDiagnosticBuilder &DB = S.Diag(Loc, this->DiagID);
2274 this->emit(DB, std::index_sequence_for<Ts...>());
2275 DB << T->isSizelessType() << T;
2276 }
2277 };
2278
2279 enum class CompleteTypeKind {
2280 /// Apply the normal rules for complete types. In particular,
2281 /// treat all sizeless types as incomplete.
2282 Normal,
2283
2284 /// Relax the normal rules for complete types so that they include
2285 /// sizeless built-in types.
2287
2288 // FIXME: Eventually we should flip the default to Normal and opt in
2289 // to AcceptSizeless rather than opt out of it.
2291 };
2292
2294
2295private:
2296 /// Methods for marking which expressions involve dereferencing a pointer
2297 /// marked with the 'noderef' attribute. Expressions are checked bottom up as
2298 /// they are parsed, meaning that a noderef pointer may not be accessed. For
2299 /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
2300 /// `*p`, but need to check that `address of` is called on it. This requires
2301 /// keeping a container of all pending expressions and checking if the address
2302 /// of them are eventually taken.
2303 void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
2304 void CheckAddressOfNoDeref(const Expr *E);
2305 void CheckMemberAccessOfNoDeref(const MemberExpr *E);
2306
2307 bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
2308 CompleteTypeKind Kind, TypeDiagnoser *Diagnoser);
2309
2310 struct ModuleScope {
2311 SourceLocation BeginLoc;
2312 clang::Module *Module = nullptr;
2313 bool ModuleInterface = false;
2314 VisibleModuleSet OuterVisibleModules;
2315 };
2316 /// The modules we're currently parsing.
2318
2319 /// For an interface unit, this is the implicitly imported interface unit.
2320 clang::Module *ThePrimaryInterface = nullptr;
2321
2322 /// The explicit global module fragment of the current translation unit.
2323 /// The explicit Global Module Fragment, as specified in C++
2324 /// [module.global.frag].
2325 clang::Module *TheGlobalModuleFragment = nullptr;
2326
2327 /// The implicit global module fragments of the current translation unit.
2328 /// We would only create at most two implicit global module fragments to
2329 /// avoid performance penalties when there are many language linkage
2330 /// exports.
2331 ///
2332 /// The contents in the implicit global module fragment can't be discarded
2333 /// no matter if it is exported or not.
2334 clang::Module *TheImplicitGlobalModuleFragment = nullptr;
2335 clang::Module *TheExportedImplicitGlobalModuleFragment = nullptr;
2336
2337 /// Namespace definitions that we will export when they finish.
2338 llvm::SmallPtrSet<const NamespaceDecl*, 8> DeferredExportedNamespaces;
2339
2340 /// In a C++ standard module, inline declarations require a definition to be
2341 /// present at the end of a definition domain. This set holds the decls to
2342 /// be checked at the end of the TU.
2343 llvm::SmallPtrSet<const FunctionDecl *, 8> PendingInlineFuncDecls;
2344
2345 /// Helper function to judge if we are in module purview.
2346 /// Return false if we are not in a module.
2347 bool isCurrentModulePurview() const {
2348 return getCurrentModule() ? getCurrentModule()->isModulePurview() : false;
2349 }
2350
2351 /// Enter the scope of the explicit global module fragment.
2352 Module *PushGlobalModuleFragment(SourceLocation BeginLoc);
2353 /// Leave the scope of the explicit global module fragment.
2354 void PopGlobalModuleFragment();
2355
2356 /// Enter the scope of an implicit global module fragment.
2357 Module *PushImplicitGlobalModuleFragment(SourceLocation BeginLoc,
2358 bool IsExported);
2359 /// Leave the scope of an implicit global module fragment.
2360 void PopImplicitGlobalModuleFragment();
2361
2362 VisibleModuleSet VisibleModules;
2363
2364 /// Cache for module units which is usable for current module.
2365 llvm::DenseSet<const Module *> UsableModuleUnitsCache;
2366
2367 bool isUsableModule(const Module *M);
2368
2369 bool isAcceptableSlow(const NamedDecl *D, AcceptableKind Kind);
2370
2371public:
2372 /// Get the module unit whose scope we are currently within.
2374 return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
2375 }
2376
2377 /// Is the module scope we are an interface?
2379 return ModuleScopes.empty() ? false : ModuleScopes.back().ModuleInterface;
2380 }
2381
2382 /// Is the module scope we are in a C++ Header Unit?
2384 return ModuleScopes.empty() ? false
2385 : ModuleScopes.back().Module->isHeaderUnit();
2386 }
2387
2388 /// Get the module owning an entity.
2389 Module *getOwningModule(const Decl *Entity) {
2390 return Entity->getOwningModule();
2391 }
2392
2393 /// Make a merged definition of an existing hidden definition \p ND
2394 /// visible at the specified location.
2396
2397 bool isModuleVisible(const Module *M, bool ModulePrivate = false);
2398
2399 // When loading a non-modular PCH files, this is used to restore module
2400 // visibility.
2402 VisibleModules.setVisible(Mod, ImportLoc);
2403 }
2404
2405 /// Determine whether a declaration is visible to name lookup.
2406 bool isVisible(const NamedDecl *D) {
2407 return D->isUnconditionallyVisible() ||
2408 isAcceptableSlow(D, AcceptableKind::Visible);
2409 }
2410
2411 /// Determine whether a declaration is reachable.
2412 bool isReachable(const NamedDecl *D) {
2413 // All visible declarations are reachable.
2414 return D->isUnconditionallyVisible() ||
2415 isAcceptableSlow(D, AcceptableKind::Reachable);
2416 }
2417
2418 /// Determine whether a declaration is acceptable (visible/reachable).
2420 return Kind == AcceptableKind::Visible ? isVisible(D) : isReachable(D);
2421 }
2422
2423 /// Determine whether any declaration of an entity is visible.
2424 bool
2426 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
2427 return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
2428 }
2429
2432 /// Determine whether any declaration of an entity is reachable.
2433 bool
2435 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
2436 return isReachable(D) || hasReachableDeclarationSlow(D, Modules);
2437 }
2439 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2440
2441 bool hasVisibleMergedDefinition(const NamedDecl *Def);
2443
2444 /// Determine if \p D and \p Suggested have a structurally compatible
2445 /// layout as described in C11 6.2.7/1.
2446 bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
2447
2448 /// Determine if \p D has a visible definition. If not, suggest a declaration
2449 /// that should be made visible to expose the definition.
2450 bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
2451 bool OnlyNeedComplete = false);
2453 NamedDecl *Hidden;
2454 return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
2455 }
2456
2457 /// Determine if \p D has a reachable definition. If not, suggest a
2458 /// declaration that should be made reachable to expose the definition.
2459 bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested,
2460 bool OnlyNeedComplete = false);
2462 NamedDecl *Hidden;
2463 return hasReachableDefinition(D, &Hidden);
2464 }
2465
2466 bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
2467 AcceptableKind Kind,
2468 bool OnlyNeedComplete = false);
2470 NamedDecl *Hidden;
2471 return hasAcceptableDefinition(D, &Hidden, Kind);
2472 }
2473
2474 /// Determine if the template parameter \p D has a visible default argument.
2475 bool
2477 llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2478 /// Determine if the template parameter \p D has a reachable default argument.
2480 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2481 /// Determine if the template parameter \p D has a reachable default argument.
2485
2486 /// Determine if there is a visible declaration of \p D that is an explicit
2487 /// specialization declaration for a specialization of a template. (For a
2488 /// member specialization, use hasVisibleMemberSpecialization.)
2490 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2491 /// Determine if there is a reachable declaration of \p D that is an explicit
2492 /// specialization declaration for a specialization of a template. (For a
2493 /// member specialization, use hasReachableMemberSpecialization.)
2495 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2496
2497 /// Determine if there is a visible declaration of \p D that is a member
2498 /// specialization declaration (as opposed to an instantiated declaration).
2500 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2501 /// Determine if there is a reachable declaration of \p D that is a member
2502 /// specialization declaration (as opposed to an instantiated declaration).
2504 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2505
2506 /// Determine if \p A and \p B are equivalent internal linkage declarations
2507 /// from different modules, and thus an ambiguity error can be downgraded to
2508 /// an extension warning.
2510 const NamedDecl *B);
2512 SourceLocation Loc, const NamedDecl *D,
2514
2516
2517 // Check whether the size of array element of type \p EltTy is a multiple of
2518 // its alignment and return false if it isn't.
2520
2523 return !RequireCompleteTypeImpl(Loc, T, Kind, nullptr);
2524 }
2526 CompleteTypeKind Kind, TypeDiagnoser &Diagnoser);
2528 CompleteTypeKind Kind, unsigned DiagID);
2529
2531 TypeDiagnoser &Diagnoser) {
2532 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, Diagnoser);
2533 }
2534 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID) {
2535 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, DiagID);
2536 }
2537
2538 template <typename... Ts>
2539 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
2540 const Ts &...Args) {
2541 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2542 return RequireCompleteType(Loc, T, Diagnoser);
2543 }
2544
2545 template <typename... Ts>
2547 const Ts &... Args) {
2548 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2549 return RequireCompleteType(Loc, T, CompleteTypeKind::Normal, Diagnoser);
2550 }
2551
2552 /// Get the type of expression E, triggering instantiation to complete the
2553 /// type if necessary -- that is, if the expression refers to a templated
2554 /// static data member of incomplete array type.
2555 ///
2556 /// May still return an incomplete type if instantiation was not possible or
2557 /// if the type is incomplete for a different reason. Use
2558 /// RequireCompleteExprType instead if a diagnostic is expected for an
2559 /// incomplete expression type.
2561
2564 TypeDiagnoser &Diagnoser);
2565 bool RequireCompleteExprType(Expr *E, unsigned DiagID);
2566
2567 template <typename... Ts>
2568 bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
2569 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2571 }
2572
2573 template <typename... Ts>
2574 bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID,
2575 const Ts &... Args) {
2576 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2578 }
2579
2581 TypeDiagnoser &Diagnoser);
2582 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
2583
2584 template <typename... Ts>
2585 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
2586 const Ts &...Args) {
2587 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2588 return RequireLiteralType(Loc, T, Diagnoser);
2589 }
2590
2591 QualType getElaboratedType(ElaboratedTypeKeyword Keyword,
2592 const CXXScopeSpec &SS, QualType T,
2593 TagDecl *OwnedTagDecl = nullptr);
2594
2595 // Returns the underlying type of a decltype with the given expression.
2597
2599 /// If AsUnevaluated is false, E is treated as though it were an evaluated
2600 /// context, such as when building a type for decltype(auto).
2601 QualType BuildDecltypeType(Expr *E, bool AsUnevaluated = true);
2602
2603 using UTTKind = UnaryTransformType::UTTKind;
2605 SourceLocation Loc);
2611 SourceLocation Loc);
2613 SourceLocation Loc);
2615 SourceLocation Loc);
2617 SourceLocation Loc);
2619 SourceLocation Loc);
2620
2621 //===--------------------------------------------------------------------===//
2622 // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
2623 //
2624
2626 SkipBodyInfo() = default;
2627 bool ShouldSkip = false;
2630 NamedDecl *New = nullptr;
2631 };
2632
2633 DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
2634
2636
2637 bool isSimpleTypeSpecifier(tok::TokenKind Kind) const;
2638
2640 Scope *S, CXXScopeSpec *SS = nullptr,
2641 bool isClassName = false, bool HasTrailingDot = false,
2642 ParsedType ObjectType = nullptr,
2643 bool IsCtorOrDtorName = false,
2644 bool WantNontrivialTypeSourceInfo = false,
2645 bool IsClassTemplateDeductionContext = true,
2646 ImplicitTypenameContext AllowImplicitTypename =
2648 IdentifierInfo **CorrectedII = nullptr);
2650 bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
2652 SourceLocation IILoc,
2653 Scope *S,
2654 CXXScopeSpec *SS,
2655 ParsedType &SuggestedType,
2656 bool IsTemplateName = false);
2657
2658 /// Attempt to behave like MSVC in situations where lookup of an unqualified
2659 /// type name has failed in a dependent context. In these situations, we
2660 /// automatically form a DependentTypeName that will retry lookup in a related
2661 /// scope during instantiation.
2663 SourceLocation NameLoc,
2664 bool IsTemplateTypeArg);
2665
2666 /// Describes the result of the name lookup and resolution performed
2667 /// by \c ClassifyName().
2669 /// This name is not a type or template in this context, but might be
2670 /// something else.
2672 /// Classification failed; an error has been produced.
2674 /// The name has been typo-corrected to a keyword.
2676 /// The name was classified as a type.
2678 /// The name was classified as a specific non-type, non-template
2679 /// declaration. ActOnNameClassifiedAsNonType should be called to
2680 /// convert the declaration to an expression.
2682 /// The name was classified as an ADL-only function name.
2683 /// ActOnNameClassifiedAsUndeclaredNonType should be called to convert the
2684 /// result to an expression.
2686 /// The name denotes a member of a dependent type that could not be
2687 /// resolved. ActOnNameClassifiedAsDependentNonType should be called to
2688 /// convert the result to an expression.
2690 /// The name was classified as an overload set, and an expression
2691 /// representing that overload set has been formed.
2692 /// ActOnNameClassifiedAsOverloadSet should be called to form a suitable
2693 /// expression referencing the overload set.
2695 /// The name was classified as a template whose specializations are types.
2697 /// The name was classified as a variable template name.
2699 /// The name was classified as a function template name.
2701 /// The name was classified as an ADL-only function template name.
2703 /// The name was classified as a concept name.
2705 };
2706
2709 union {
2714 };
2715
2716 explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
2717
2718 public:
2720
2722
2725 }
2726
2730
2733 Result.Expr = E;
2734 return Result;
2735 }
2736
2739 Result.NonTypeDecl = D;
2740 return Result;
2741 }
2742
2746
2750
2753 Result.Template = Name;
2754 return Result;
2755 }
2756
2759 Result.Template = Name;
2760 return Result;
2761 }
2762
2765 Result.Template = Name;
2766 return Result;
2767 }
2768
2771 Result.Template = Name;
2772 return Result;
2773 }
2774
2780
2781 NameClassificationKind getKind() const { return Kind; }
2782
2784 assert(Kind == NC_OverloadSet);
2785 return Expr;
2786 }
2787
2789 assert(Kind == NC_Type);
2790 return Type;
2791 }
2792
2794 assert(Kind == NC_NonType);
2795 return NonTypeDecl;
2796 }
2797
2799 assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
2800 Kind == NC_VarTemplate || Kind == NC_Concept ||
2801 Kind == NC_UndeclaredTemplate);
2802 return Template;
2803 }
2804
2806 switch (Kind) {
2807 case NC_TypeTemplate:
2808 return TNK_Type_template;
2810 return TNK_Function_template;
2811 case NC_VarTemplate:
2812 return TNK_Var_template;
2813 case NC_Concept:
2814 return TNK_Concept_template;
2817 default:
2818 llvm_unreachable("unsupported name classification.");
2819 }
2820 }
2821 };
2822
2823 /// Perform name lookup on the given name, classifying it based on
2824 /// the results of name lookup and the following token.
2825 ///
2826 /// This routine is used by the parser to resolve identifiers and help direct
2827 /// parsing. When the identifier cannot be found, this routine will attempt
2828 /// to correct the typo and classify based on the resulting name.
2829 ///
2830 /// \param S The scope in which we're performing name lookup.
2831 ///
2832 /// \param SS The nested-name-specifier that precedes the name.
2833 ///
2834 /// \param Name The identifier. If typo correction finds an alternative name,
2835 /// this pointer parameter will be updated accordingly.
2836 ///
2837 /// \param NameLoc The location of the identifier.
2838 ///
2839 /// \param NextToken The token following the identifier. Used to help
2840 /// disambiguate the name.
2841 ///
2842 /// \param CCC The correction callback, if typo correction is desired.
2843 NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS,
2844 IdentifierInfo *&Name, SourceLocation NameLoc,
2845 const Token &NextToken,
2846 CorrectionCandidateCallback *CCC = nullptr);
2847
2848 /// Act on the result of classifying a name as an undeclared (ADL-only)
2849 /// non-type declaration.
2851 SourceLocation NameLoc);
2852 /// Act on the result of classifying a name as an undeclared member of a
2853 /// dependent base class.
2855 IdentifierInfo *Name,
2856 SourceLocation NameLoc,
2857 bool IsAddressOfOperand);
2858 /// Act on the result of classifying a name as a specific non-type
2859 /// declaration.
2861 NamedDecl *Found,
2862 SourceLocation NameLoc,
2863 const Token &NextToken);
2864 /// Act on the result of classifying a name as an overload set.
2866
2867 /// Describes the detailed kind of a template name. Used in diagnostics.
2879
2880 /// Determine whether it's plausible that E was intended to be a
2881 /// template-name.
2883 if (!getLangOpts().CPlusPlus || E.isInvalid())
2884 return false;
2885 Dependent = false;
2886 if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
2887 return !DRE->hasExplicitTemplateArgs();
2888 if (auto *ME = dyn_cast<MemberExpr>(E.get()))
2889 return !ME->hasExplicitTemplateArgs();
2890 Dependent = true;
2891 if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
2892 return !DSDRE->hasExplicitTemplateArgs();
2893 if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
2894 return !DSME->hasExplicitTemplateArgs();
2895 // Any additional cases recognized here should also be handled by
2896 // diagnoseExprIntendedAsTemplateName.
2897 return false;
2898 }
2902
2903 void warnOnReservedIdentifier(const NamedDecl *D);
2904
2906
2908 MultiTemplateParamsArg TemplateParameterLists);
2910 QualType &T, SourceLocation Loc,
2911 unsigned FailedFoldDiagID);
2916 bool IsTemplateId);
2917 void
2918 diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
2919 SourceLocation FallbackLoc,
2920 SourceLocation ConstQualLoc = SourceLocation(),
2921 SourceLocation VolatileQualLoc = SourceLocation(),
2922 SourceLocation RestrictQualLoc = SourceLocation(),
2923 SourceLocation AtomicQualLoc = SourceLocation(),
2924 SourceLocation UnalignedQualLoc = SourceLocation());
2925
2927 void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
2929 const LookupResult &R);
2932 const LookupResult &R);
2933 void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
2934 const LookupResult &R);
2935 void CheckShadow(Scope *S, VarDecl *D);
2936
2937 /// Warn if 'E', which is an expression that is about to be modified, refers
2938 /// to a shadowing declaration.
2940
2942
2943private:
2944 /// Map of current shadowing declarations to shadowed declarations. Warn if
2945 /// it looks like the user is trying to modify the shadowing declaration.
2946 llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
2947
2948public:
2949 void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
2950 void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
2951 void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
2952 TypedefNameDecl *NewTD);
2955 TypeSourceInfo *TInfo,
2958 LookupResult &Previous, bool &Redeclaration);
2960 Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo,
2961 LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists,
2962 bool &AddToScope, ArrayRef<BindingDecl *> Bindings = std::nullopt);
2963 NamedDecl *
2965 MultiTemplateParamsArg TemplateParamLists);
2966 // Returns true if the variable declaration is a redeclaration
2970 Expr *Init);
2974
2976 TypeSourceInfo *TInfo,
2978 MultiTemplateParamsArg TemplateParamLists,
2979 bool &AddToScope);
2981
2983 /// Diagnose issues that are non-constant or that are extensions.
2984 Diagnose,
2985 /// Identify whether this function satisfies the formal rules for constexpr
2986 /// functions in the current lanugage mode (with no extensions).
2988 };
2989
2991 CheckConstexprKind Kind);
2992
2995 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2997 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2998 // Returns true if the function declaration is a redeclaration
3001 bool IsMemberSpecialization, bool DeclIsDefn);
3004 QualType NewT, QualType OldT);
3005 void CheckMain(FunctionDecl *FD, const DeclSpec &D);
3009 bool IsDefinition);
3013 SourceLocation Loc,
3014 QualType T);
3016 SourceLocation NameLoc, IdentifierInfo *Name,
3017 QualType T, TypeSourceInfo *TSInfo,
3018 StorageClass SC);
3019 void ActOnParamDefaultArgument(Decl *param,
3020 SourceLocation EqualLoc,
3021 Expr *defarg);
3023 SourceLocation ArgLoc);
3024 void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
3026 SourceLocation EqualLoc);
3027 void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
3028 SourceLocation EqualLoc);
3029
3030 // Contexts where using non-trivial C union types can be disallowed. This is
3031 // passed to err_non_trivial_c_union_in_invalid_context.
3033 // Function parameter.
3035 // Function return.
3037 // Default-initialized object.
3039 // Variable with automatic storage duration.
3041 // Initializer expression that might copy from another object.
3043 // Assignment.
3045 // Compound literal.
3047 // Block capture.
3049 // lvalue-to-rvalue conversion of volatile type.
3051 };
3052
3053 /// Emit diagnostics if the initializer or any of its explicit or
3054 /// implicitly-generated subexpressions require copying or
3055 /// default-initializing a type that is or contains a C union type that is
3056 /// non-trivial to copy or default-initialize.
3058
3059 // These flags are passed to checkNonTrivialCUnion.
3065
3066 /// Emit diagnostics if a non-trivial C union type or a struct that contains
3067 /// a non-trivial C union is used in an invalid context.
3069 NonTrivialCUnionContext UseContext,
3070 unsigned NonTrivialKind);
3071
3072 void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
3073 void ActOnUninitializedDecl(Decl *dcl);
3074 void ActOnInitializerError(Decl *Dcl);
3075
3076 void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
3077 void ActOnCXXForRangeDecl(Decl *D);
3079 IdentifierInfo *Ident,
3080 ParsedAttributes &Attrs);
3081 void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
3082 void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
3085 void FinalizeDeclaration(Decl *D);
3087 ArrayRef<Decl *> Group);
3089
3090 /// Should be called on all declarations that might have attached
3091 /// documentation comments.
3092 void ActOnDocumentableDecl(Decl *D);
3094
3095 enum class FnBodyKind {
3096 /// C++ [dcl.fct.def.general]p1
3097 /// function-body:
3098 /// ctor-initializer[opt] compound-statement
3099 /// function-try-block
3100 Other,
3101 /// = default ;
3102 Default,
3103 /// = delete ;
3104 Delete
3105 };
3106
3108 SourceLocation LocAfterDecls);
3110 FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
3111 SkipBodyInfo *SkipBody = nullptr);
3113 MultiTemplateParamsArg TemplateParamLists,
3114 SkipBodyInfo *SkipBody = nullptr,
3115 FnBodyKind BodyKind = FnBodyKind::Other);
3117 SkipBodyInfo *SkipBody = nullptr,
3118 FnBodyKind BodyKind = FnBodyKind::Other);
3119 void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind);
3125 return D && isa<ObjCMethodDecl>(D);
3126 }
3127
3128 /// Determine whether we can delay parsing the body of a function or
3129 /// function template until it is used, assuming we don't care about emitting
3130 /// code for that function.
3131 ///
3132 /// This will be \c false if we may need the body of the function in the
3133 /// middle of parsing an expression (where it's impractical to switch to
3134 /// parsing a different function), for instance, if it's constexpr in C++11
3135 /// or has an 'auto' return type in C++14. These cases are essentially bugs.
3136 bool canDelayFunctionBody(const Declarator &D);
3137
3138 /// Determine whether we can skip parsing the body of a function
3139 /// definition, assuming we don't care about analyzing its body or emitting
3140 /// code for that function.
3141 ///
3142 /// This will be \c false only if we may need the body of the function in
3143 /// order to parse the rest of the program (for instance, if it is
3144 /// \c constexpr in C++11 or has an 'auto' return type in C++14).
3145 bool canSkipFunctionBody(Decl *D);
3146
3147 /// Determine whether \param D is function like (function or function
3148 /// template) for parsing.
3150
3153 Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
3156
3157 /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
3158 /// attribute for which parsing is delayed.
3160
3161 /// Diagnose any unused parameters in the given sequence of
3162 /// ParmVarDecl pointers.
3164
3165 /// Diagnose whether the size of parameters or return value of a
3166 /// function or obj-c method definition is pass-by-value and larger than a
3167 /// specified threshold.
3168 void
3170 QualType ReturnTy, NamedDecl *D);
3171
3172 void DiagnoseInvalidJumps(Stmt *Body);
3174 SourceLocation AsmLoc,
3175 SourceLocation RParenLoc);
3176
3177 Decl *ActOnTopLevelStmtDecl(Stmt *Statement);
3178
3179 /// Handle a C++11 empty-declaration and attribute-declaration.
3181 SourceLocation SemiLoc);
3182
3183 enum class ModuleDeclKind {
3184 Interface, ///< 'export module X;'
3185 Implementation, ///< 'module X;'
3186 PartitionInterface, ///< 'export module X:Y;'
3187 PartitionImplementation, ///< 'module X:Y;'
3188 };
3189
3190 /// An enumeration to represent the transition of states in parsing module
3191 /// fragments and imports. If we are not parsing a C++20 TU, or we find
3192 /// an error in state transition, the state is set to NotACXX20Module.
3194 FirstDecl, ///< Parsing the first decl in a TU.
3195 GlobalFragment, ///< after 'module;' but before 'module X;'
3196 ImportAllowed, ///< after 'module X;' but before any non-import decl.
3197 ImportFinished, ///< after any non-import decl.
3198 PrivateFragmentImportAllowed, ///< after 'module :private;' but before any
3199 ///< non-import decl.
3200 PrivateFragmentImportFinished, ///< after 'module :private;' but a
3201 ///< non-import decl has already been seen.
3202 NotACXX20Module ///< Not a C++20 TU, or an invalid state was found.
3203 };
3204
3205private:
3206 /// The parser has begun a translation unit to be compiled as a C++20
3207 /// Header Unit, helper for ActOnStartOfTranslationUnit() only.
3208 void HandleStartOfHeaderUnit();
3209
3210public:
3211 /// The parser has processed a module-declaration that begins the definition
3212 /// of a module interface or implementation.
3214 SourceLocation ModuleLoc, ModuleDeclKind MDK,
3215 ModuleIdPath Path, ModuleIdPath Partition,
3216 ModuleImportState &ImportState);
3217
3218 /// The parser has processed a global-module-fragment declaration that begins
3219 /// the definition of the global module fragment of the current module unit.
3220 /// \param ModuleLoc The location of the 'module' keyword.
3222
3223 /// The parser has processed a private-module-fragment declaration that begins
3224 /// the definition of the private module fragment of the current module unit.
3225 /// \param ModuleLoc The location of the 'module' keyword.
3226 /// \param PrivateLoc The location of the 'private' keyword.
3228 SourceLocation PrivateLoc);
3229
3230 /// The parser has processed a module import declaration.
3231 ///
3232 /// \param StartLoc The location of the first token in the declaration. This
3233 /// could be the location of an '@', 'export', or 'import'.
3234 /// \param ExportLoc The location of the 'export' keyword, if any.
3235 /// \param ImportLoc The location of the 'import' keyword.
3236 /// \param Path The module toplevel name as an access path.
3237 /// \param IsPartition If the name is for a partition.
3239 SourceLocation ExportLoc,
3240 SourceLocation ImportLoc, ModuleIdPath Path,
3241 bool IsPartition = false);
3243 SourceLocation ExportLoc,
3244 SourceLocation ImportLoc, Module *M,
3245 ModuleIdPath Path = {});
3246
3247 /// The parser has processed a module import translated from a
3248 /// #include or similar preprocessing directive.
3249 void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
3250 void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
3251
3252 /// The parsed has entered a submodule.
3253 void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
3254 /// The parser has left a submodule.
3255 void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
3256
3257 /// Create an implicit import of the given module at the given
3258 /// source location, for error recovery, if possible.
3259 ///
3260 /// This routine is typically used when an entity found by name lookup
3261 /// is actually hidden within a module that we know about but the user
3262 /// has forgotten to import.
3263 void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
3264 Module *Mod);
3265
3266 /// Kinds of missing import. Note, the values of these enumerators correspond
3267 /// to %select values in diagnostics.
3275
3276 /// Diagnose that the specified declaration needs to be visible but
3277 /// isn't, and suggest a module import that would resolve the problem.
3279 MissingImportKind MIK, bool Recover = true);
3281 SourceLocation DeclLoc, ArrayRef<Module *> Modules,
3282 MissingImportKind MIK, bool Recover);
3283
3285 SourceLocation LBraceLoc);
3287 SourceLocation RBraceLoc);
3288
3289 /// We've found a use of a templated declaration that would trigger an
3290 /// implicit instantiation. Check that any relevant explicit specializations
3291 /// and partial specializations are visible/reachable, and diagnose if not.
3294
3295 /// Retrieve a suitable printing policy for diagnostics.
3299
3300 /// Retrieve a suitable printing policy for diagnostics.
3302 const Preprocessor &PP);
3303
3304 /// Scope actions.
3305 void ActOnPopScope(SourceLocation Loc, Scope *S);
3307
3309 const ParsedAttributesView &DeclAttrs,
3310 RecordDecl *&AnonRecord);
3312 const ParsedAttributesView &DeclAttrs,
3313 MultiTemplateParamsArg TemplateParams,
3314 bool IsExplicitInstantiation,
3315 RecordDecl *&AnonRecord);
3316
3318 AccessSpecifier AS,
3319 RecordDecl *Record,
3320 const PrintingPolicy &Policy);
3321
3323 RecordDecl *Record);
3324
3325 /// Common ways to introduce type names without a tag for use in diagnostics.
3326 /// Keep in sync with err_tag_reference_non_tag.
3338
3339 /// Given a non-tag type declaration, returns an enum useful for indicating
3340 /// what kind of non-tag type this is.
3341 NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK);
3342
3344 TagTypeKind NewTag, bool isDefinition,
3345 SourceLocation NewTagLoc,
3346 const IdentifierInfo *Name);
3347
3349 TUK_Reference, // Reference to a tag: 'struct foo *X;'
3350 TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
3351 TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
3352 TUK_Friend // Friend declaration: 'friend struct foo;'
3354
3356 // Not parsing a type within __builtin_offsetof.
3358 // Parsing a type within __builtin_offsetof.
3360 // Parsing a type within macro "offsetof", defined in __buitin_offsetof
3361 // To improve our diagnostic message.
3363 };
3364
3365 DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
3366 SourceLocation KWLoc, CXXScopeSpec &SS,
3367 IdentifierInfo *Name, SourceLocation NameLoc,
3369 SourceLocation ModulePrivateLoc,
3370 MultiTemplateParamsArg TemplateParameterLists,
3371 bool &OwnedDecl, bool &IsDependent,
3372 SourceLocation ScopedEnumKWLoc,
3373 bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
3374 bool IsTypeSpecifier, bool IsTemplateParamOrArg,
3375 OffsetOfKind OOK, SkipBodyInfo *SkipBody = nullptr);
3376
3378 unsigned TagSpec, SourceLocation TagLoc,
3379 CXXScopeSpec &SS, IdentifierInfo *Name,
3380 SourceLocation NameLoc,
3382 MultiTemplateParamsArg TempParamLists);
3383
3385 unsigned TagSpec,
3386 TagUseKind TUK,
3387 const CXXScopeSpec &SS,
3388 IdentifierInfo *Name,
3389 SourceLocation TagLoc,
3390 SourceLocation NameLoc);
3391
3392 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
3393 IdentifierInfo *ClassName,
3395 Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
3396 Declarator &D, Expr *BitfieldWidth);
3397
3398 FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
3399 Declarator &D, Expr *BitfieldWidth,
3400 InClassInitStyle InitStyle,
3401 AccessSpecifier AS);
3403 SourceLocation DeclStart, Declarator &D,
3404 Expr *BitfieldWidth,
3405 InClassInitStyle InitStyle,
3406 AccessSpecifier AS,
3407 const ParsedAttr &MSPropertyAttr);
3408
3410 TypeSourceInfo *TInfo,
3411 RecordDecl *Record, SourceLocation Loc,
3412 bool Mutable, Expr *BitfieldWidth,
3413 InClassInitStyle InitStyle,
3414 SourceLocation TSSL,
3415 AccessSpecifier AS, NamedDecl *PrevDecl,
3416 Declarator *D = nullptr);
3417
3419 void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
3420
3422 /// The triviality of a method unaffected by "trivial_abi".
3424
3425 /// The triviality of a method affected by "trivial_abi".
3428
3429 bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
3431 bool Diagnose = false);
3432
3433 /// For a defaulted function, the kind of defaulted function that it is.
3435 CXXSpecialMember SpecialMember : 8;
3436 DefaultedComparisonKind Comparison : 8;
3437
3438 public:
3440 : SpecialMember(CXXInvalid), Comparison(DefaultedComparisonKind::None) {
3441 }
3443 : SpecialMember(CSM), Comparison(DefaultedComparisonKind::None) {}
3445 : SpecialMember(CXXInvalid), Comparison(Comp) {}
3446
3447 bool isSpecialMember() const { return SpecialMember != CXXInvalid; }
3448 bool isComparison() const {
3449 return Comparison != DefaultedComparisonKind::None;
3450 }
3451
3452 explicit operator bool() const {
3453 return isSpecialMember() || isComparison();
3454 }
3455
3456 CXXSpecialMember asSpecialMember() const { return SpecialMember; }
3457 DefaultedComparisonKind asComparison() const { return Comparison; }
3458
3459 /// Get the index of this function kind for use in diagnostics.
3460 unsigned getDiagnosticIndex() const {
3461 static_assert(CXXInvalid > CXXDestructor,
3462 "invalid should have highest index");
3463 static_assert((unsigned)DefaultedComparisonKind::None == 0,
3464 "none should be equal to zero");
3465 return SpecialMember + (unsigned)Comparison;
3466 }
3467 };
3468
3469 DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD);
3470
3477
3478 void ActOnLastBitfield(SourceLocation DeclStart,
3479 SmallVectorImpl<Decl *> &AllIvarDecls);
3480 Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
3481 Declarator &D, Expr *BitfieldWidth,
3482 tok::ObjCKeywordKind visibility);
3483
3484 // This is used for both record definitions and ObjC interface declarations.
3485 void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
3486 ArrayRef<Decl *> Fields, SourceLocation LBrac,
3487 SourceLocation RBrac, const ParsedAttributesView &AttrList);
3488
3489 /// ActOnTagStartDefinition - Invoked when we have entered the
3490 /// scope of a tag's definition (e.g., for an enumeration, class,
3491 /// struct, or union).
3493
3494 /// Perform ODR-like check for C/ObjC when merging tag types from modules.
3495 /// Differently from C++, actually parse the body and reject / error out
3496 /// in case of a structural mismatch.
3497 bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody);
3498
3499 /// Check ODR hashes for C/ObjC when merging types from modules.
3500 /// Differently from C++, actually parse the body and reject in case
3501 /// of a mismatch.
3502 template <typename T,
3503 typename = std::enable_if_t<std::is_base_of<NamedDecl, T>::value>>
3505 if (Duplicate->getODRHash() != Previous->getODRHash())
3506 return false;
3507
3508 // Make the previous decl visible.
3510 return true;
3511 }
3512
3514
3515 /// Invoked when we enter a tag definition that we're skipping.
3517
3519
3520 /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
3521 /// C++ record definition's base-specifiers clause and are starting its
3522 /// member declarations.
3524 SourceLocation FinalLoc,
3525 bool IsFinalSpelledSealed,
3526 bool IsAbstract,
3527 SourceLocation LBraceLoc);
3528
3529 /// ActOnTagFinishDefinition - Invoked once we have finished parsing
3530 /// the definition of a tag (enumeration, class, struct, or union).
3532 SourceRange BraceRange);
3533
3535
3537
3538 /// Invoked when we must temporarily exit the objective-c container
3539 /// scope for parsing/looking-up C constructs.
3540 ///
3541 /// Must be followed by a call to \see ActOnObjCReenterContainerContext
3544
3545 /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
3546 /// error parsing the definition of a tag.
3548
3550 EnumConstantDecl *LastEnumConst,
3551 SourceLocation IdLoc,
3553 Expr *val);
3555 bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
3556 QualType EnumUnderlyingTy, bool IsFixed,
3557 const EnumDecl *Prev);
3558
3559 /// Determine whether the body of an anonymous enumeration should be skipped.
3560 /// \param II The name of the first enumerator.
3562 SourceLocation IILoc);
3563
3564 Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
3566 const ParsedAttributesView &Attrs,
3567 SourceLocation EqualLoc, Expr *Val);
3568 void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
3569 Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
3570 const ParsedAttributesView &Attr);
3571
3572 /// Set the current declaration context until it gets popped.
3573 void PushDeclContext(Scope *S, DeclContext *DC);
3574 void PopDeclContext();
3575
3576 /// EnterDeclaratorContext - Used when we must lookup names in the context
3577 /// of a declarator's nested name specifier.
3580
3581 /// Enter a template parameter scope, after it's been associated with a particular
3582 /// DeclContext. Causes lookup within the scope to chain through enclosing contexts
3583 /// in the correct order.
3585
3586 /// Push the parameters of D, which must be a function, into scope.
3589
3590 /// If \p AllowLambda is true, treat lambda as function.
3591 DeclContext *getFunctionLevelDeclContext(bool AllowLambda = false) const;
3592
3593 /// Returns a pointer to the innermost enclosing function, or nullptr if the
3594 /// current context is not inside a function. If \p AllowLambda is true,
3595 /// this can return the call operator of an enclosing lambda, otherwise
3596 /// lambdas are skipped when looking for an enclosing function.
3597 FunctionDecl *getCurFunctionDecl(bool AllowLambda = false) const;
3598
3599 /// getCurMethodDecl - If inside of a method body, this returns a pointer to
3600 /// the method decl for the method being parsed. If we're currently
3601 /// in a 'block', this returns the containing context.
3603
3604 /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
3605 /// or C function we're in, otherwise return null. If we're currently
3606 /// in a 'block', this returns the containing context.
3608
3609 /// Add this decl to the scope shadowed decl chains.
3610 void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
3611
3612 /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
3613 /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
3614 /// true if 'D' belongs to the given declaration context.
3615 ///
3616 /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
3617 /// enclosing namespace set of the context, rather than contained
3618 /// directly within it.
3619 bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
3620 bool AllowInlineNamespace = false) const;
3621
3622 /// Finds the scope corresponding to the given decl context, if it
3623 /// happens to be an enclosing scope. Otherwise return NULL.
3625
3626 /// Subroutines of ActOnDeclarator().
3628 TypeSourceInfo *TInfo);
3630
3631 /// Describes the kind of merge to perform for availability
3632 /// attributes (including "deprecated", "unavailable", and "availability").
3634 /// Don't merge availability attributes at all.
3636 /// Merge availability attributes for a redeclaration, which requires
3637 /// an exact match.
3639 /// Merge availability attributes for an override, which requires
3640 /// an exact match or a weakening of constraints.
3642 /// Merge availability attributes for an implementation of
3643 /// a protocol requirement.
3645 /// Merge availability attributes for an implementation of
3646 /// an optional protocol requirement.
3649
3650 /// Describes the kind of priority given to an availability attribute.
3651 ///
3652 /// The sum of priorities deteremines the final priority of the attribute.
3653 /// The final priority determines how the attribute will be merged.
3654 /// An attribute with a lower priority will always remove higher priority
3655 /// attributes for the specified platform when it is being applied. An
3656 /// attribute with a higher priority will not be applied if the declaration
3657 /// already has an availability attribute with a lower priority for the
3658 /// specified platform. The final prirority values are not expected to match
3659 /// the values in this enumeration, but instead should be treated as a plain
3660 /// integer value. This enumeration just names the priority weights that are
3661 /// used to calculate that final vaue.
3663 /// The availability attribute was specified explicitly next to the
3664 /// declaration.
3666
3667 /// The availability attribute was applied using '#pragma clang attribute'.
3669
3670 /// The availability attribute for a specific platform was inferred from
3671 /// an availability attribute for another platform.
3674
3675 /// Attribute merging methods. Return true if a new attribute was added.
3676 AvailabilityAttr *
3678 IdentifierInfo *Platform, bool Implicit,
3679 VersionTuple Introduced, VersionTuple Deprecated,
3680 VersionTuple Obsoleted, bool IsUnavailable,
3681 StringRef Message, bool IsStrict, StringRef Replacement,
3682 AvailabilityMergeKind AMK, int Priority);
3683 TypeVisibilityAttr *
3685 TypeVisibilityAttr::VisibilityType Vis);
3686 VisibilityAttr *mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
3687 VisibilityAttr::VisibilityType Vis);
3688 UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
3689 StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
3690 DLLImportAttr *mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI);
3691 DLLExportAttr *mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI);
3692 MSInheritanceAttr *mergeMSInheritanceAttr(Decl *D,
3693 const AttributeCommonInfo &CI,
3694 bool BestCase,
3695 MSInheritanceModel Model);
3696 ErrorAttr *mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI,
3697 StringRef NewUserDiagnostic);
3698 FormatAttr *mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
3699 IdentifierInfo *Format, int FormatIdx,
3700 int FirstArg);
3701 SectionAttr *mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
3702 StringRef Name);
3703 CodeSegAttr *mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
3704 StringRef Name);
3705 AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D,
3706 const AttributeCommonInfo &CI,
3707 const IdentifierInfo *Ident);
3708 MinSizeAttr *mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI);
3709 SwiftNameAttr *mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA,
3710 StringRef Name);
3711 OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D,
3712 const AttributeCommonInfo &CI);
3713 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
3714 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
3715 const InternalLinkageAttr &AL);
3716 WebAssemblyImportNameAttr *mergeImportNameAttr(
3717 Decl *D, const WebAssemblyImportNameAttr &AL);
3718 WebAssemblyImportModuleAttr *mergeImportModuleAttr(
3719 Decl *D, const WebAssemblyImportModuleAttr &AL);
3720 EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
3721 EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
3722 const EnforceTCBLeafAttr &AL);
3723 BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL);
3724 HLSLNumThreadsAttr *mergeHLSLNumThreadsAttr(Decl *D,
3725 const AttributeCommonInfo &AL,
3726 int X, int Y, int Z);
3727 HLSLShaderAttr *mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL,
3728 HLSLShaderAttr::ShaderType ShaderType);
3729
3730 void mergeDeclAttributes(NamedDecl *New, Decl *Old,
3733 LookupResult &OldDecls);
3734 bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
3735 bool MergeTypeWithOld, bool NewDeclIsDefn);
3737 Scope *S, bool MergeTypeWithOld);
3740 void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
3742 bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
3743 void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
3745
3746 // AssignmentAction - This is used by all the assignment diagnostic functions
3747 // to represent what is actually causing the operation
3758
3759 /// C++ Overloading.
3761 /// This is a legitimate overload: the existing declarations are
3762 /// functions or function templates with different signatures.
3764
3765 /// This is not an overload because the signature exactly matches
3766 /// an existing declaration.
3768
3769 /// This is not an overload because the lookup results contain a
3770 /// non-function.
3774 FunctionDecl *New,
3775 const LookupResult &OldDecls,
3776 NamedDecl *&OldDecl,
3777 bool UseMemberUsingDeclRules);
3778 bool IsOverload(FunctionDecl *New, FunctionDecl *Old,
3779 bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs = true,
3780 bool ConsiderRequiresClauses = true);
3781
3782 // Calculates whether the expression Constraint depends on an enclosing
3783 // template, for the purposes of [temp.friend] p9.
3784 // TemplateDepth is the 'depth' of the friend function, which is used to
3785 // compare whether a declaration reference is referring to a containing
3786 // template, or just the current friend function. A 'lower' TemplateDepth in
3787 // the AST refers to a 'containing' template. As the constraint is
3788 // uninstantiated, this is relative to the 'top' of the TU.
3789 bool
3791 unsigned TemplateDepth,
3792 const Expr *Constraint);
3793
3794 // Calculates whether the friend function depends on an enclosing template for
3795 // the purposes of [temp.friend] p9.
3797
3798 // Calculates whether two constraint expressions are equal irrespective of a
3799 // difference in 'depth'. This takes a pair of optional 'NamedDecl's 'Old' and
3800 // 'New', which are the "source" of the constraint, since this is necessary
3801 // for figuring out the relative 'depth' of the constraint. The depth of the
3802 // 'primary template' and the 'instantiated from' templates aren't necessarily
3803 // the same, such as a case when one is a 'friend' defined in a class.
3805 const Expr *OldConstr,
3806 const NamedDecl *New,
3807 const Expr *NewConstr);
3808
3809 enum class AllowedExplicit {
3810 /// Allow no explicit functions to be used.
3811 None,
3812 /// Allow explicit conversion functions but not explicit constructors.
3814 /// Allow both explicit conversion functions and explicit constructors.
3815 All
3816 };
3817
3819 TryImplicitConversion(Expr *From, QualType ToType,
3820 bool SuppressUserConversions,
3821 AllowedExplicit AllowExplicit,
3822 bool InOverloadResolution,
3823 bool CStyle,
3824 bool AllowObjCWritebackConversion);
3825
3826 bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
3827 bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
3828 bool IsComplexPromotion(QualType FromType, QualType ToType);
3829 bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
3830 bool InOverloadResolution,
3831 QualType& ConvertedType, bool &IncompatibleObjC);
3832 bool isObjCPointerConversion(QualType FromType, QualType ToType,
3833 QualType& ConvertedType, bool &IncompatibleObjC);
3834 bool isObjCWritebackConversion(QualType FromType, QualType ToType,
3835 QualType &ConvertedType);
3836 bool IsBlockPointerConversion(QualType FromType, QualType ToType,
3837 QualType& ConvertedType);
3839 const FunctionProtoType *NewType,
3840 unsigned *ArgPos = nullptr,
3841 bool Reversed = false);
3843 QualType FromType, QualType ToType);
3844
3847 bool CheckPointerConversion(Expr *From, QualType ToType,
3848 CastKind &Kind,
3849 CXXCastPath& BasePath,
3850 bool IgnoreBaseAccess,
3851 bool Diagnose = true);
3852 bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
3853 bool InOverloadResolution,
3854 QualType &ConvertedType);
3855 bool CheckMemberPointerConversion(Expr *From, QualType ToType,
3856 CastKind &Kind,
3857 CXXCastPath &BasePath,
3858 bool IgnoreBaseAccess);
3859 bool IsQualificationConversion(QualType FromType, QualType ToType,
3860 bool CStyle, bool &ObjCLifetimeConversion);
3861 bool IsFunctionConversion(QualType FromType, QualType ToType,
3862 QualType &ResultTy);
3865
3867 const InitializedEntity &Entity, InitListExpr *From);
3868
3869 bool IsStringInit(Expr *Init, const ArrayType *AT);
3870
3872 ExprResult Init);
3874 SourceLocation EqualLoc,
3875 ExprResult Init,
3876 bool TopLevelOfInitList = false,
3877 bool AllowExplicit = false);
3879 NestedNameSpecifier *Qualifier,
3880 NamedDecl *FoundDecl,
3881 CXXMethodDecl *Method);
3882
3883 /// Check that the lifetime of the initializer (and its subobjects) is
3884 /// sufficient for initializing the entity, and perform lifetime extension
3885 /// (when permitted) if not.
3886 void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init);
3887
3890
3891 /// Contexts in which a converted constant expression is required.
3892 enum CCEKind {
3893 CCEK_CaseValue, ///< Expression in a case label.
3894 CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
3895 CCEK_TemplateArg, ///< Value of a non-type template parameter.
3896 CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
3897 CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
3898 CCEK_Noexcept, ///< Condition in a noexcept(bool) specifier.
3899 CCEK_StaticAssertMessageSize, ///< Call to size() in a static assert
3900 ///< message.
3901 CCEK_StaticAssertMessageData, ///< Call to data() in a static assert
3902 ///< message.
3903 };
3904
3906 CCEKind CCE,
3907 NamedDecl *Dest = nullptr);
3908
3910 llvm::APSInt &Value, CCEKind CCE);
3912 APValue &Value, CCEKind CCE,
3913 NamedDecl *Dest = nullptr);
3914
3915 /// Abstract base class used to perform a contextual implicit
3916 /// conversion from an expression to any type passing a filter.
3918 public:
3921
3925
3926 /// Determine whether the specified type is a valid destination type
3927 /// for this conversion.
3928 virtual bool match(QualType T) = 0;
3929
3930 /// Emits a diagnostic complaining that the expression does not have
3931 /// integral or enumeration type.
3932 virtual SemaDiagnosticBuilder
3934
3935 /// Emits a diagnostic when the expression has incomplete class type.
3936 virtual SemaDiagnosticBuilder
3938
3939 /// Emits a diagnostic when the only matching conversion function
3940 /// is explicit.
3942 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3943
3944 /// Emits a note for the explicit conversion function.
3945 virtual SemaDiagnosticBuilder
3947
3948 /// Emits a diagnostic when there are multiple possible conversion
3949 /// functions.
3950 virtual SemaDiagnosticBuilder
3952
3953 /// Emits a note for one of the candidate conversions.
3954 virtual SemaDiagnosticBuilder
3956
3957 /// Emits a diagnostic when we picked a conversion function
3958 /// (for cases when we are not allowed to pick a conversion function).
3960 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3961
3963 };
3964
3966 bool AllowScopedEnumerations;
3967
3968 public:
3969 ICEConvertDiagnoser(bool AllowScopedEnumerations,
3970 bool Suppress, bool SuppressConversion)
3972 AllowScopedEnumerations(AllowScopedEnumerations) {}
3973
3974 /// Match an integral or (possibly scoped) enumeration type.
3975 bool match(QualType T) override;
3976
3979 return diagnoseNotInt(S, Loc, T);
3980 }
3981
3982 /// Emits a diagnostic complaining that the expression does not have
3983 /// integral or enumeration type.
3984 virtual SemaDiagnosticBuilder
3986 };
3987
3988 /// Perform a contextual implicit conversion.
3990 SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
3991
3992
3999
4000 // Note that LK_String is intentionally after the other literals, as
4001 // this is used for diagnostics logic.
4012
4014 NestedNameSpecifier *Qualifier,
4015 NamedDecl *FoundDecl,
4016 NamedDecl *Member);
4017
4018 // Members have to be NamespaceDecl* or TranslationUnitDecl*.
4019 // TODO: make this is a typesafe union.
4022
4024
4026 FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef<Expr *> Args,
4027 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
4028 bool PartialOverloading = false, bool AllowExplicit = true,
4029 bool AllowExplicitConversion = false,
4030 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
4031 ConversionSequenceList EarlyConversions = std::nullopt,
4033 bool AggregateCandidateDeduction = false);
4034 void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
4035 ArrayRef<Expr *> Args,
4036 OverloadCandidateSet &CandidateSet,
4037 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
4038 bool SuppressUserConversions = false,
4039 bool PartialOverloading = false,
4040 bool FirstArgumentIsBase = false);
4041 void AddMethodCandidate(DeclAccessPair FoundDecl,
4042 QualType ObjectType,
4043 Expr::Classification ObjectClassification,
4044 ArrayRef<Expr *> Args,
4045 OverloadCandidateSet& CandidateSet,
4046 bool SuppressUserConversion = false,
4048 void
4049 AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
4050 CXXRecordDecl *ActingContext, QualType ObjectType,
4051 Expr::Classification ObjectClassification,
4052 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
4053 bool SuppressUserConversions = false,
4054 bool PartialOverloading = false,
4055 ConversionSequenceList EarlyConversions = std::nullopt,
4057 void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
4058 DeclAccessPair FoundDecl,
4059 CXXRecordDecl *ActingContext,
4060 TemplateArgumentListInfo *ExplicitTemplateArgs,
4061 QualType ObjectType,
4062 Expr::Classification ObjectClassification,
4063 ArrayRef<Expr *> Args,
4064 OverloadCandidateSet& CandidateSet,
4065 bool SuppressUserConversions = false,
4066 bool PartialOverloading = false,
4069 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
4070 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
4071 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
4072 bool PartialOverloading = false, bool AllowExplicit = true,
4073 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
4075 bool AggregateCandidateDeduction = false);
4077 FunctionTemplateDecl *FunctionTemplate, ArrayRef<QualType> ParamTypes,
4078 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
4079 ConversionSequenceList &Conversions, bool SuppressUserConversions,
4080 CXXRecordDecl *ActingContext = nullptr, QualType ObjectType = QualType(),
4081 Expr::Classification ObjectClassification = {},
4084 CXXConversionDecl *Conversion, DeclAccessPair FoundDecl,
4085 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
4086 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
4087 bool AllowExplicit, bool AllowResultConversion = true);
4089 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
4090 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
4091 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
4092 bool AllowExplicit, bool AllowResultConversion = true);
4093 void AddSurrogateCandidate(CXXConversionDecl *Conversion,
4094 DeclAccessPair FoundDecl,
4095 CXXRecordDecl *ActingContext,
4096 const FunctionProtoType *Proto,
4097 Expr *Object, ArrayRef<Expr *> Args,
4098 OverloadCandidateSet& CandidateSet);
4100 const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
4101 OverloadCandidateSet &CandidateSet,
4102 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
4103 void AddMemberOperatorCandidates(OverloadedOperatorKind Op,
4104 SourceLocation OpLoc, ArrayRef<Expr *> Args,
4105 OverloadCandidateSet &CandidateSet,
4107 void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
4108 OverloadCandidateSet& CandidateSet,
4109 bool IsAssignmentOperator = false,
4110 unsigned NumContextualBoolArguments = 0);
4111 void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
4112 SourceLocation OpLoc, ArrayRef<Expr *> Args,
4113 OverloadCandidateSet& CandidateSet);
4114 void AddArgumentDependentLookupCandidates(DeclarationName Name,
4115 SourceLocation Loc,
4116 ArrayRef<Expr *> Args,
4117 TemplateArgumentListInfo *ExplicitTemplateArgs,
4118 OverloadCandidateSet& CandidateSet,
4119 bool PartialOverloading = false);
4120
4121 // Emit as a 'note' the specific overload candidate
4123 const NamedDecl *Found, const FunctionDecl *Fn,
4125 QualType DestType = QualType(), bool TakingAddress = false);
4126
4127 // Emit as a series of 'note's all template and non-templates identified by
4128 // the expression Expr
4129 void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
4130 bool TakingAddress = false);
4131
4132 /// Check the enable_if expressions on the given function. Returns the first
4133 /// failing attribute, or NULL if they were all successful.
4134 EnableIfAttr *CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc,
4135 ArrayRef<Expr *> Args,
4136 bool MissingImplicitThis = false);
4137
4138 /// Find the failed Boolean condition within a given Boolean
4139 /// constant expression, and describe it with a string.
4140 std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond);
4141
4142 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
4143 /// non-ArgDependent DiagnoseIfAttrs.
4144 ///
4145 /// Argument-dependent diagnose_if attributes should be checked each time a
4146 /// function is used as a direct callee of a function call.
4147 ///
4148 /// Returns true if any errors were emitted.
4149 bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
4150 const Expr *ThisArg,
4151 ArrayRef<const Expr *> Args,
4152 SourceLocation Loc);
4153
4154 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
4155 /// ArgDependent DiagnoseIfAttrs.
4156 ///
4157 /// Argument-independent diagnose_if attributes should be checked on every use
4158 /// of a function.
4159 ///
4160 /// Returns true if any errors were emitted.
4161 bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
4162 SourceLocation Loc);
4163
4164 /// Returns whether the given function's address can be taken or not,
4165 /// optionally emitting a diagnostic if the address can't be taken.
4166 ///
4167 /// Returns false if taking the address of the function is illegal.
4168 bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
4169 bool Complain = false,
4170 SourceLocation Loc = SourceLocation());
4171
4172 // [PossiblyAFunctionType] --> [Return]
4173 // NonFunctionType --> NonFunctionType
4174 // R (A) --> R(A)
4175 // R (*)(A) --> R (A)
4176 // R (&)(A) --> R (A)
4177 // R (S::*)(A) --> R (A)
4178 QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
4179
4180 FunctionDecl *
4181 ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
4182 QualType TargetType,
4183 bool Complain,
4184 DeclAccessPair &Found,
4185 bool *pHadMultipleCandidates = nullptr);
4186
4187 FunctionDecl *
4188 resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult);
4189
4191 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
4192
4194 OverloadExpr *ovl, bool Complain = false, DeclAccessPair *Found = nullptr,
4195 TemplateSpecCandidateSet *FailedTSC = nullptr);
4196
4198 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
4199 bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
4200 QualType DestTypeForComplaining = QualType(),
4201 unsigned DiagIDForComplaining = 0);
4202
4203 Expr *FixOverloadedFunctionReference(Expr *E,
4204 DeclAccessPair FoundDecl,
4205 FunctionDecl *Fn);
4207 DeclAccessPair FoundDecl,
4208 FunctionDecl *Fn);
4209
4210 void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
4211 ArrayRef<Expr *> Args,
4212 OverloadCandidateSet &CandidateSet,
4213 bool PartialOverloading = false);
4215 LookupResult &R, TemplateArgumentListInfo *ExplicitTemplateArgs,
4216 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet);
4217
4218 // An enum used to represent the different possible results of building a
4219 // range-based for loop.
4225
4227 SourceLocation RangeLoc,
4228 const DeclarationNameInfo &NameInfo,
4229 LookupResult &MemberLookup,
4230 OverloadCandidateSet *CandidateSet,
4231 Expr *Range, ExprResult *CallExpr);
4232
4235 SourceLocation LParenLoc,
4236 MultiExprArg Args,
4237 SourceLocation RParenLoc,
4238 Expr *ExecConfig,
4239 bool AllowTypoCorrection=true,
4240 bool CalleesAddressIsTaken=false);
4241
4243 MultiExprArg Args, SourceLocation RParenLoc,
4244 OverloadCandidateSet *CandidateSet,
4246
4250 const UnresolvedSetImpl &Fns,
4251 bool PerformADL = true);
4252
4255 const UnresolvedSetImpl &Fns,
4256 Expr *input, bool RequiresADL = true);
4257
4260 const UnresolvedSetImpl &Fns,
4261 ArrayRef<Expr *> Args, bool RequiresADL = true);
4264 const UnresolvedSetImpl &Fns,
4265 Expr *LHS, Expr *RHS,
4266 bool RequiresADL = true,
4267 bool AllowRewrittenCandidates = true,
4268 FunctionDecl *DefaultedFn = nullptr);
4270 const UnresolvedSetImpl &Fns,
4271 Expr *LHS, Expr *RHS,
4272 FunctionDecl *DefaultedFn);
4273
4275 SourceLocation RLoc, Expr *Base,
4276 MultiExprArg Args);
4277
4279 SourceLocation LParenLoc,
4280 MultiExprArg Args,
4281 SourceLocation RParenLoc,
4282 Expr *ExecConfig = nullptr,
4283 bool IsExecConfig = false,
4284 bool AllowRecovery = false);
4287 MultiExprArg Args,
4288 SourceLocation RParenLoc);
4289
4291 SourceLocation OpLoc,
4292 bool *NoArrowOperatorFound = nullptr);
4293
4294 /// CheckCallReturnType - Checks that a call expression's return type is
4295 /// complete. Returns true on failure. The location passed in is the location
4296 /// that best represents the call.
4297 bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
4298 CallExpr *CE, FunctionDecl *FD);
4299
4300 /// Helpers for dealing with blocks and functions.
4302 bool CheckParameterNames);
4306
4307 /// \name Name lookup
4308 ///
4309 /// These routines provide name lookup that is used during semantic
4310 /// analysis to resolve the various kinds of names (identifiers,
4311 /// overloaded operator names, constructor names, etc.) into zero or
4312 /// more declarations within a particular scope. The major entry
4313 /// points are LookupName, which performs unqualified name lookup,
4314 /// and LookupQualifiedName, which performs qualified name lookup.
4315 ///
4316 /// All name lookup is performed based on some specific criteria,
4317 /// which specify what names will be visible to name lookup and how
4318 /// far name lookup should work. These criteria are important both
4319 /// for capturing language semantics (certain lookups will ignore
4320 /// certain names, for example) and for performance, since name
4321 /// lookup is often a bottleneck in the compilation of C++. Name
4322 /// lookup criteria is specified via the LookupCriteria enumeration.
4323 ///
4324 /// The results of name lookup can vary based on the kind of name
4325 /// lookup performed, the current language, and the translation
4326 /// unit. In C, for example, name lookup will either return nothing
4327 /// (no entity found) or a single declaration. In C++, name lookup
4328 /// can additionally refer to a set of overloaded functions or
4329 /// result in an ambiguity. All of the possible results of name
4330 /// lookup are captured by the LookupResult class, which provides
4331 /// the ability to distinguish among them.
4332 //@{
4333
4334 /// Describes the kind of name lookup to perform.
4336 /// Ordinary name lookup, which finds ordinary names (functions,
4337 /// variables, typedefs, etc.) in C and most kinds of names
4338 /// (functions, variables, members, types, etc.) in C++.
4340 /// Tag name lookup, which finds the names of enums, classes,
4341 /// structs, and unions.
4343 /// Label name lookup.
4345 /// Member name lookup, which finds the names of
4346 /// class/struct/union members.
4348 /// Look up of an operator name (e.g., operator+) for use with
4349 /// operator overloading. This lookup is similar to ordinary name
4350 /// lookup, but will ignore any declarations that are class members.
4352 /// Look up a name following ~ in a destructor name. This is an ordinary
4353 /// lookup, but prefers tags to typedefs.
4355 /// Look up of a name that precedes the '::' scope resolution
4356 /// operator in C++. This lookup completely ignores operator, object,
4357 /// function, and enumerator names (C++ [basic.lookup.qual]p1).
4359 /// Look up a namespace name within a C++ using directive or
4360 /// namespace alias definition, ignoring non-namespace names (C++
4361 /// [basic.lookup.udir]p1).
4363 /// Look up all declarations in a scope with the given name,
4364 /// including resolved using declarations. This is appropriate
4365 /// for checking redeclarations for a using declaration.
4367 /// Look up an ordinary name that is going to be redeclared as a
4368 /// name with linkage. This lookup ignores any declarations that
4369 /// are outside of the current scope unless they have linkage. See
4370 /// C99 6.2.2p4-5 and C++ [basic.link]p6.
4372 /// Look up a friend of a local class. This lookup does not look
4373 /// outside the innermost non-class scope. See C++11 [class.friend]p11.
4375 /// Look up the name of an Objective-C protocol.
4377 /// Look up implicit 'self' parameter of an objective-c method.
4379 /// Look up the name of an OpenMP user-defined reduction operation.
4381 /// Look up the name of an OpenMP user-defined mapper.
4383 /// Look up any declaration with any name.
4386
4387 /// Specifies whether (or how) name lookup is being performed for a
4388 /// redeclaration (vs. a reference).
4390 /// The lookup is a reference to this name that is not for the
4391 /// purpose of redeclaring the name.
4393 /// The lookup results will be used for redeclaration of a name,
4394 /// if an entity by that name already exists and is visible.
4396 /// The lookup results will be used for redeclaration of a name
4397 /// with external linkage; non-visible lookup results with external linkage
4398 /// may also be found.
4401
4403 // A declaration with an owning module for linkage can never link against
4404 // anything that is not visible. We don't need to check linkage here; if
4405 // the context has internal linkage, redeclaration lookup won't find things
4406 // from other TUs, and we can't safely compute linkage yet in general.
4407 if (cast<Decl>(CurContext)
4408 ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
4411 }
4412
4413 /// The possible outcomes of name lookup for a literal operator.
4415 /// The lookup resulted in an error.
4417 /// The lookup found no match but no diagnostic was issued.
4419 /// The lookup found a single 'cooked' literal operator, which
4420 /// expects a normal literal to be built and passed to it.
4422 /// The lookup found a single 'raw' literal operator, which expects
4423 /// a string literal containing the spelling of the literal token.
4425 /// The lookup found an overload set of literal operator templates,
4426 /// which expect the characters of the spelling of the literal token to be
4427 /// passed as a non-type template argument pack.
4429 /// The lookup found an overload set of literal operator templates,
4430 /// which expect the character type and characters of the spelling of the
4431 /// string literal token to be passed as template arguments.
4433 };
4434
4435 SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
4436 CXXSpecialMember SM,
4437 bool ConstArg,
4438 bool VolatileArg,
4439 bool RValueThis,
4440 bool ConstThis,
4441 bool VolatileThis);
4442
4443 typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
4444 typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
4446
4447private:
4448 bool CppLookupName(LookupResult &R, Scope *S);
4449
4450 struct TypoExprState {
4451 std::unique_ptr<TypoCorrectionConsumer> Consumer;
4452 TypoDiagnosticGenerator DiagHandler;
4453 TypoRecoveryCallback RecoveryHandler;
4454 TypoExprState();
4455 TypoExprState(TypoExprState &&other) noexcept;
4456 TypoExprState &operator=(TypoExprState &&other) noexcept;
4457 };
4458
4459 /// The set of unhandled TypoExprs and their associated state.
4460 llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
4461
4462 /// Creates a new TypoExpr AST node.
4463 TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
4466
4467 // The set of known/encountered (unique, canonicalized) NamespaceDecls.
4468 //
4469 // The boolean value will be true to indicate that the namespace was loaded
4470 // from an AST/PCH file, or false otherwise.
4471 llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
4472
4473 /// Whether we have already loaded known namespaces from an extenal
4474 /// source.
4475 bool LoadedExternalKnownNamespaces;
4476
4477 /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
4478 /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
4479 /// should be skipped entirely.
4480 std::unique_ptr<TypoCorrectionConsumer>
4481 makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
4482 Sema::LookupNameKind LookupKind, Scope *S,
4483 CXXScopeSpec *SS,
4485 DeclContext *MemberContext, bool EnteringContext,
4486 const ObjCObjectPointerType *OPT,
4487 bool ErrorRecovery);
4488
4489public:
4490 const TypoExprState &getTypoExprState(TypoExpr *TE) const;
4491
4492 /// Clears the state of the given TypoExpr.
4493 void clearDelayedTypo(TypoExpr *TE);
4494
4495 /// Look up a name, looking for a single declaration. Return
4496 /// null if the results were absent, ambiguous, or overloaded.
4497 ///
4498 /// It is preferable to use the elaborated form and explicitly handle
4499 /// ambiguity and overloaded.
4501 SourceLocation Loc,
4502 LookupNameKind NameKind,
4503 RedeclarationKind Redecl
4505 bool LookupBuiltin(LookupResult &R);
4506 void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID);
4507 bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation = false,
4508 bool ForceNoCPlusPlus = false);
4509 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4510 bool InUnqualifiedLookup = false);
4511 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4512 CXXScopeSpec &SS);
4514 bool AllowBuiltinCreation = false,
4515 bool EnteringContext = false);
4517 RedeclarationKind Redecl
4519 bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
4520
4522 UnresolvedSetImpl &Functions);
4523
4525 SourceLocation GnuLabelLoc = SourceLocation());
4526
4530 unsigned Quals);
4531 CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
4532 bool RValueThis, unsigned ThisQuals);
4534 unsigned Quals);
4535 CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
4536 bool RValueThis, unsigned ThisQuals);
4538
4539 bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id,
4540 bool IsUDSuffix);
4543 bool AllowRaw, bool AllowTemplate,
4544 bool AllowStringTemplate, bool DiagnoseMissing,
4545 StringLiteral *StringLit = nullptr);
4546 bool isKnownName(StringRef name);
4547
4548 /// Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
4550 Emitted,
4551 CUDADiscarded, // Discarded due to CUDA/HIP hostness
4552 OMPDiscarded, // Discarded due to OpenMP hostness
4553 TemplateDiscarded, // Discarded due to uninstantiated templates
4554 Unknown,
4555 };
4556 FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl,
4557 bool Final = false);
4558
4559 // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
4561
4563 ArrayRef<Expr *> Args, ADLResult &Functions);
4564
4565 void LookupVisibleDecls(Scope *S, LookupNameKind Kind,
4567 bool IncludeGlobalScope = true,
4568 bool LoadExternal = true);
4569 void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
4571 bool IncludeGlobalScope = true,
4572 bool IncludeDependentBases = false,
4573 bool LoadExternal = true);
4574
4576 CTK_NonError, // CorrectTypo used in a non error recovery situation.
4577 CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
4579
4581 Sema::LookupNameKind LookupKind,
4582 Scope *S, CXXScopeSpec *SS,
4584 CorrectTypoKind Mode,
4585 DeclContext *MemberContext = nullptr,
4586 bool EnteringContext = false,
4587 const ObjCObjectPointerType *OPT = nullptr,
4588 bool RecordFailure = true);
4589
4591 Sema::LookupNameKind LookupKind, Scope *S,
4592 CXXScopeSpec *SS,
4596 DeclContext *MemberContext = nullptr,
4597 bool EnteringContext = false,
4598 const ObjCObjectPointerType *OPT = nullptr);
4599
4600 /// Process any TypoExprs in the given Expr and its children,
4601 /// generating diagnostics as appropriate and returning a new Expr if there
4602 /// were typos that were all successfully corrected and ExprError if one or
4603 /// more typos could not be corrected.
4604 ///
4605 /// \param E The Expr to check for TypoExprs.
4606 ///
4607 /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
4608 /// initializer.
4609 ///
4610 /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
4611 /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
4612 ///
4613 /// \param Filter A function applied to a newly rebuilt Expr to determine if
4614 /// it is an acceptable/usable result from a single combination of typo
4615 /// corrections. As long as the filter returns ExprError, different
4616 /// combinations of corrections will be tried until all are exhausted.
4618 Expr *E, VarDecl *InitDecl = nullptr,
4619 bool RecoverUncorrectedTypos = false,
4620 llvm::function_ref<ExprResult(Expr *)> Filter =
4621 [](Expr *E) -> ExprResult { return E; });
4622
4624 ExprResult ER, VarDecl *InitDecl = nullptr,
4625 bool RecoverUncorrectedTypos = false,
4626 llvm::function_ref<ExprResult(Expr *)> Filter =
4627 [](Expr *E) -> ExprResult { return E; }) {
4628 return ER.isInvalid()
4629 ? ER
4630 : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
4631 RecoverUncorrectedTypos, Filter);
4632 }
4633
4634 void diagnoseTypo(const TypoCorrection &Correction,
4635 const PartialDiagnostic &TypoDiag,
4636 bool ErrorRecovery = true);
4637
4638 void diagnoseTypo(const TypoCorrection &Correction,
4639 const PartialDiagnostic &TypoDiag,
4640 const PartialDiagnostic &PrevNote,
4641 bool ErrorRecovery = true);
4642
4643 void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F);
4644
4645 void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
4646 ArrayRef<Expr *> Args,
4647 AssociatedNamespaceSet &AssociatedNamespaces,
4648 AssociatedClassSet &AssociatedClasses);
4649
4650 void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S,
4651 bool ConsiderLinkage, bool AllowInlineNamespace);
4652
4653 bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old);
4654 bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old);
4655 bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old);
4656 bool IsRedefinitionInModule(const NamedDecl *New,
4657 const NamedDecl *Old) const;
4658
4659 void DiagnoseAmbiguousLookup(LookupResult &Result);
4660 //@}
4661
4662 /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
4663 ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End,
4664 ArrayRef<Expr *> SubExprs,
4665 QualType T = QualType());
4666
4667 ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
4668 SourceLocation IdLoc,
4669 bool TypoCorrection = false);
4670 FunctionDecl *CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID,
4671 SourceLocation Loc);
4672 NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
4673 Scope *S, bool ForRedeclaration,
4674 SourceLocation Loc);
4675 NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
4676 Scope *S);
4678 FunctionDecl *FD);
4679 void AddKnownFunctionAttributes(FunctionDecl *FD);
4680
4681 // More parsing and symbol table subroutines.
4682
4683 void ProcessPragmaWeak(Scope *S, Decl *D);
4684 // Decl attributes - this routine is the top level dispatcher.
4685 void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
4686 // Helper for delayed processing of attributes.
4687 void ProcessDeclAttributeDelayed(Decl *D,
4688 const ParsedAttributesView &AttrList);
4689
4690 // Options for ProcessDeclAttributeList().
4694
4700
4706
4707 // Should C++11 attributes be processed?
4709
4710 // Should any type attributes encountered be ignored?
4711 // If this option is false, a diagnostic will be emitted for any type
4712 // attributes of a kind that does not "slide" from the declaration to
4713 // the decl-specifier-seq.
4715 };
4716
4718 const ParsedAttributesView &AttrList,
4719 const ProcessDeclAttributeOptions &Options =
4722 const ParsedAttributesView &AttrList);
4723
4725
4726 /// Handles semantic checking for features that are common to all attributes,
4727 /// such as checking whether a parameter was properly specified, or the
4728 /// correct number of arguments were passed, etc. Returns true if the
4729 /// attribute has been diagnosed.
4730 bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A,
4731 bool SkipArgCountCheck = false);
4732 bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
4733 bool SkipArgCountCheck = false);
4734
4735 /// Determine if type T is a valid subject for a nonnull and similar
4736 /// attributes. By default, we look through references (the behavior used by
4737 /// nonnull), but if the second parameter is true, then we treat a reference
4738 /// type as valid.
4739 bool isValidPointerAttrType(QualType T, bool RefOkay = false);
4740
4741 bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value);
4742 bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC,
4743 const FunctionDecl *FD = nullptr);
4744 bool CheckAttrTarget(const ParsedAttr &CurrAttr);
4745 bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
4747 const Expr *E, StringRef &Str,
4748 SourceLocation *ArgLocation = nullptr);
4749 bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum,
4750 StringRef &Str,
4751 SourceLocation *ArgLocation = nullptr);
4752 llvm::Error isValidSectionSpecifier(StringRef Str);
4753 bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
4754 bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
4755 bool checkTargetVersionAttr(SourceLocation LiteralLoc, StringRef &Str,
4756 bool &isDefault);
4757 bool
4758 checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str,
4759 const StringLiteral *Literal, bool &HasDefault,
4760 bool &HasCommas, bool &HasNotDefault,
4761 SmallVectorImpl<SmallString<64>> &StringsBuffer);
4763 CXXRecordDecl *RD, SourceRange Range, bool BestCase,
4764 MSInheritanceModel SemanticSpelling);
4765
4767
4768 bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
4769 const AttributeCommonInfo &A);
4770 bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
4771 const AttributeCommonInfo &A);
4772
4773 /// Adjust the calling convention of a method to be the ABI default if it
4774 /// wasn't specified explicitly. This handles method types formed from
4775 /// function type typedefs and typename template arguments.
4776 void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
4777 SourceLocation Loc);
4778
4779 // Check if there is an explicit attribute, but only look through parens.
4780 // The intent is to look for an attribute on the current declarator, but not
4781 // one that came from a typedef.
4783
4784 /// Get the outermost AttributedType node that sets a calling convention.
4785 /// Valid types should not have multiple attributes with different CCs.
4786 const AttributedType *getCallingConvAttributedType(QualType T) const;
4787
4788 /// Process the attributes before creating an attributed statement. Returns
4789 /// the semantic attributes that have been processed.
4790 void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs,
4792
4794 ObjCMethodDecl *MethodDecl,
4795 bool IsProtocolMethodDecl);
4796
4798 ObjCMethodDecl *Overridden,
4799 bool IsProtocolMethodDecl);
4800
4801 /// WarnExactTypedMethods - This routine issues a warning if method
4802 /// implementation declaration matches exactly that of its declaration.
4804 ObjCMethodDecl *MethodDecl,
4805 bool IsProtocolMethodDecl);
4806
4808
4809 /// CheckImplementationIvars - This routine checks if the instance variables
4810 /// listed in the implelementation match those listed in the interface.
4812 ObjCIvarDecl **Fields, unsigned nIvars,
4813 SourceLocation Loc);
4814
4815 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
4816 /// remains unimplemented in the class or category \@implementation.
4818 ObjCContainerDecl* IDecl,
4819 bool IncompleteImpl = false);
4820
4821 /// DiagnoseUnimplementedProperties - This routine warns on those properties
4822 /// which must be implemented by this implementation.
4824 ObjCContainerDecl *CDecl,
4825 bool SynthesizeProperties);
4826
4827 /// Diagnose any null-resettable synthesized setters.
4829
4830 /// DefaultSynthesizeProperties - This routine default synthesizes all
4831 /// properties which must be synthesized in the class's \@implementation.
4833 ObjCInterfaceDecl *IDecl,
4834 SourceLocation AtEnd);
4836
4837 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
4838 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
4839 /// declared in class 'IFace'.
4841 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
4842
4843 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
4844 /// backs the property is not used in the property's accessor.
4846 const ObjCImplementationDecl *ImplD);
4847
4848 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
4849 /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
4850 /// It also returns ivar's property on success.
4852 const ObjCPropertyDecl *&PDecl) const;
4853
4854 /// Called by ActOnProperty to handle \@property declarations in
4855 /// class extensions.
4857 SourceLocation AtLoc,
4858 SourceLocation LParenLoc,
4859 FieldDeclarator &FD,
4860 Selector GetterSel,
4861 SourceLocation GetterNameLoc,
4862 Selector SetterSel,
4863 SourceLocation SetterNameLoc,
4864 const bool isReadWrite,
4865 unsigned &Attributes,
4866 const unsigned AttributesAsWritten,
4867 QualType T,
4868 TypeSourceInfo *TSI,
4869 tok::ObjCKeywordKind MethodImplKind);
4870
4871 /// Called by ActOnProperty and HandlePropertyInClassExtension to
4872 /// handle creating the ObjcPropertyDecl for a category or \@interface.
4874 ObjCContainerDecl *CDecl,
4875 SourceLocation AtLoc,
4876 SourceLocation LParenLoc,
4877 FieldDeclarator &FD,
4878 Selector GetterSel,
4879 SourceLocation GetterNameLoc,
4880 Selector SetterSel,
4881 SourceLocation SetterNameLoc,
4882 const bool isReadWrite,
4883 const unsigned Attributes,
4884 const unsigned AttributesAsWritten,
4885 QualType T,
4886 TypeSourceInfo *TSI,
4887 tok::ObjCKeywordKind MethodImplKind,
4888 DeclContext *lexicalDC = nullptr);
4889
4890 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
4891 /// warning) when atomic property has one but not the other user-declared
4892 /// setter or getter.
4894 ObjCInterfaceDecl* IDecl);
4895
4897
4899 const ObjCImplementationDecl *ImplD,
4900 const ObjCInterfaceDecl *IFD);
4901
4903
4908
4909 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
4910 /// true, or false, accordingly.
4911 bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
4912 const ObjCMethodDecl *PrevMethod,
4913 MethodMatchStrategy strategy = MMS_strict);
4914
4915 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
4916 /// or protocol against those declared in their implementations.
4917 void MatchAllMethodDeclarations(const SelectorSet &InsMap,
4918 const SelectorSet &ClsMap,
4919 SelectorSet &InsMapSeen,
4920 SelectorSet &ClsMapSeen,
4921 ObjCImplDecl* IMPDecl,
4922 ObjCContainerDecl* IDecl,
4923 bool &IncompleteImpl,
4924 bool ImmediateClass,
4925 bool WarnCategoryMethodImpl=false);
4926
4927 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
4928 /// category matches with those implemented in its primary class and
4929 /// warns each time an exact match is found.
4931
4932 /// Add the given method to the list of globally-known methods.
4934
4935 /// Returns default addr space for method qualifiers.
4937
4938private:
4939 /// AddMethodToGlobalPool - Add an instance or factory method to the global
4940 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
4941 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
4942
4943 /// LookupMethodInGlobalPool - Returns the instance or factory method and
4944 /// optionally warns if there are multiple signatures.
4945 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
4946 bool receiverIdOrClass,
4947 bool instance);
4948
4949public:
4950 /// - Returns instance or factory methods in global method pool for
4951 /// given selector. It checks the desired kind first, if none is found, and
4952 /// parameter checkTheOther is set, it then checks the other kind. If no such
4953 /// method or only one method is found, function returns false; otherwise, it
4954 /// returns true.
4955 bool
4958 bool InstanceFirst, bool CheckTheOther,
4959 const ObjCObjectType *TypeBound = nullptr);
4960
4961 bool
4963 SourceRange R, bool receiverIdOrClass,
4965
4966 void
4968 Selector Sel, SourceRange R,
4969 bool receiverIdOrClass);
4970
4971private:
4972 /// - Returns a selector which best matches given argument list or
4973 /// nullptr if none could be found
4974 ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
4975 bool IsInstance,
4977
4978
4979 /// Record the typo correction failure and return an empty correction.
4980 TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
4981 bool RecordFailure = true) {
4982 if (RecordFailure)
4983 TypoCorrectionFailures[Typo].insert(TypoLoc);
4984 return TypoCorrection();
4985 }
4986
4987public:
4988 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
4989 /// unit are added to a global pool. This allows us to efficiently associate
4990 /// a selector with a method declaraation for purposes of typechecking
4991 /// messages sent to "id" (where the class of the object is unknown).
4992 void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4993 AddMethodToGlobalPool(Method, impl, /*instance*/true);
4994 }
4995
4996 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
4997 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4998 AddMethodToGlobalPool(Method, impl, /*instance*/false);
4999 }
5000
5001 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
5002 /// pool.
5004
5005 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
5006 /// there are multiple signatures.
5008 bool receiverIdOrClass=false) {
5009 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
5010 /*instance*/true);
5011 }
5012
5013 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
5014 /// there are multiple signatures.
5016 bool receiverIdOrClass=false) {
5017 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
5018 /*instance*/false);
5019 }
5020
5022 QualType ObjectType=QualType());
5023 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
5024 /// implementation.
5026
5027 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
5028 /// initialization.
5031
5032 //===--------------------------------------------------------------------===//
5033 // Statement Parsing Callbacks: SemaStmt.cpp.
5034public:
5036 public:
5037 FullExprArg() : E(nullptr) { }
5038 FullExprArg(Sema &actions) : E(nullptr) { }
5039
5041 return E;
5042 }
5043
5044 Expr *get() const { return E; }
5045
5047 return E;
5048 }
5049
5050 private:
5051 // FIXME: No need to make the entire Sema class a friend when it's just
5052 // Sema::MakeFullExpr that needs access to the constructor below.
5053 friend class Sema;
5054
5055 explicit FullExprArg(Expr *expr) : E(expr) {}
5056
5057 Expr *E;
5058 };
5059
5061 return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
5062 }
5064 return FullExprArg(
5065 ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
5066 }
5068 ExprResult FE =
5069 ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
5070 /*DiscardedValue*/ true);
5071 return FullExprArg(FE.get());
5072 }
5073
5074 StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
5076
5078 bool HasLeadingEmptyMacro = false);
5079
5080 void ActOnStartOfCompoundStmt(bool IsStmtExpr);
5084 ArrayRef<Stmt *> Elts, bool isStmtExpr);
5085
5086 /// A RAII object to enter scope of a compound statement.
5088 public:
5089 CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) {
5090 S.ActOnStartOfCompoundStmt(IsStmtExpr);
5091 }
5092
5094 S.ActOnFinishOfCompoundStmt();
5095 }
5096
5097 private:
5098 Sema &S;
5099 };
5100
5101 /// An RAII helper that pops function a function scope on exit.
5107 if (Active)
5109 }
5110 void disable() { Active = false; }
5111 };
5112
5114 SourceLocation StartLoc,
5115 SourceLocation EndLoc);
5120 SourceLocation DotDotDotLoc, ExprResult RHS,
5121 SourceLocation ColonLoc);
5122 void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
5123
5125 SourceLocation ColonLoc,
5126 Stmt *SubStmt, Scope *CurScope);
5128 SourceLocation ColonLoc, Stmt *SubStmt);
5129
5131 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
5133 Stmt *SubStmt);
5134
5135 class ConditionResult;
5136
5138 SourceLocation LParenLoc, Stmt *InitStmt,
5139 ConditionResult Cond, SourceLocation RParenLoc,
5140 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
5142 SourceLocation LParenLoc, Stmt *InitStmt,
5143 ConditionResult Cond, SourceLocation RParenLoc,
5144 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
5146 SourceLocation LParenLoc, Stmt *InitStmt,
5147 ConditionResult Cond,
5148 SourceLocation RParenLoc);
5150 Stmt *Switch, Stmt *Body);
5152 ConditionResult Cond, SourceLocation RParenLoc,
5153 Stmt *Body);
5155 SourceLocation WhileLoc, SourceLocation CondLParen,
5156 Expr *Cond, SourceLocation CondRParen);
5157
5159 SourceLocation LParenLoc,
5160 Stmt *First,
5161 ConditionResult Second,
5162 FullExprArg Third,
5163 SourceLocation RParenLoc,
5164 Stmt *Body);
5166 Expr *collection);
5168 Stmt *First, Expr *collection,
5169 SourceLocation RParenLoc);
5170 StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
5171
5173 /// Initial building of a for-range statement.
5175 /// Instantiation or recovery rebuild of a for-range statement. Don't
5176 /// attempt any typo-correction.
5178 /// Determining whether a for-range statement could be built. Avoid any
5179 /// unnecessary or irreversible actions.
5182
5184 SourceLocation CoawaitLoc,
5185 Stmt *InitStmt,
5186 Stmt *LoopVar,
5187 SourceLocation ColonLoc, Expr *Collection,
5188 SourceLocation RParenLoc,
5189 BuildForRangeKind Kind);
5191 SourceLocation CoawaitLoc,
5192 Stmt *InitStmt,
5193 SourceLocation ColonLoc,
5194 Stmt *RangeDecl, Stmt *Begin, Stmt *End,
5195 Expr *Cond, Expr *Inc,
5196 Stmt *LoopVarDecl,
5197 SourceLocation RParenLoc,
5198 BuildForRangeKind Kind);
5199 StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
5200
5202 SourceLocation LabelLoc,
5203 LabelDecl *TheDecl);
5205 SourceLocation StarLoc,
5206 Expr *DestExp);
5207 StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
5208 StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
5209
5210 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
5211 CapturedRegionKind Kind, unsigned NumParams);
5212 typedef std::pair<StringRef, QualType> CapturedParamNameType;
5213 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
5214 CapturedRegionKind Kind,
5216 unsigned OpenMPCaptureLevel = 0);
5220 SourceLocation Loc,
5221 unsigned NumParams);
5222
5225
5228
5229 bool isMoveEligible() const { return S != None; };
5231 };
5233 NamedReturnInfo getNamedReturnInfo(
5235 NamedReturnInfo getNamedReturnInfo(const VarDecl *VD);
5236 const VarDecl *getCopyElisionCandidate(NamedReturnInfo &Info,
5237 QualType ReturnType);
5238
5241 const NamedReturnInfo &NRInfo, Expr *Value,
5242 bool SupressSimplerImplicitMoves = false);
5243
5244 StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
5245 Scope *CurScope);
5246 StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
5247 bool AllowRecovery = false);
5249 NamedReturnInfo &NRInfo,
5250 bool SupressSimplerImplicitMoves);
5251
5252 StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
5253 bool IsVolatile, unsigned NumOutputs,
5254 unsigned NumInputs, IdentifierInfo **Names,
5255 MultiExprArg Constraints, MultiExprArg Exprs,
5256 Expr *AsmString, MultiExprArg Clobbers,
5257 unsigned NumLabels,
5258 SourceLocation RParenLoc);
5259
5261 llvm::InlineAsmIdentifierInfo &Info);
5263 SourceLocation TemplateKWLoc,
5265 bool IsUnevaluatedContext);
5266 bool LookupInlineAsmField(StringRef Base, StringRef Member,
5267 unsigned &Offset, SourceLocation AsmLoc);
5269 SourceLocation AsmLoc);
5271 ArrayRef<Token> AsmToks,
5272 StringRef AsmString,
5273 unsigned NumOutputs, unsigned NumInputs,
5274 ArrayRef<StringRef> Constraints,
5275 ArrayRef<StringRef> Clobbers,
5276 ArrayRef<Expr*> Exprs,
5277 SourceLocation EndLoc);
5278 LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
5279 SourceLocation Location,
5280 bool AlwaysCreate);
5281
5283 SourceLocation StartLoc,
5285 bool Invalid = false);
5286
5288
5290 Decl *Parm, Stmt *Body);
5291
5293
5295 MultiStmtArg Catch, Stmt *Finally);
5296
5299 Scope *CurScope);
5301 Expr *operand);
5303 Expr *SynchExpr,
5304 Stmt *SynchBody);
5305
5307
5309 SourceLocation StartLoc,
5310 SourceLocation IdLoc,
5312
5314
5316 Decl *ExDecl, Stmt *HandlerBlock);
5318 ArrayRef<Stmt *> Handlers);
5319
5320 StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
5321 SourceLocation TryLoc, Stmt *TryBlock,
5322 Stmt *Handler);
5324 Expr *FilterExpr,
5325 Stmt *Block);
5330
5332
5334
5335 /// If it's a file scoped decl that must warn if not used, keep track
5336 /// of it.
5338
5339 typedef llvm::function_ref<void(SourceLocation Loc, PartialDiagnostic PD)>
5341
5342 /// DiagnoseUnusedExprResult - If the statement passed in is an expression
5343 /// whose result is unused, warn.
5344 void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID);
5347 DiagReceiverTy DiagReceiver);
5348 void DiagnoseUnusedDecl(const NamedDecl *ND);
5349 void DiagnoseUnusedDecl(const NamedDecl *ND, DiagReceiverTy DiagReceiver);
5350
5351 /// If VD is set but not otherwise used, diagnose, for a parameter or a
5352 /// variable.
5353 void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver);
5354
5355 /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
5356 /// statement as a \p Body, and it is located on the same line.
5357 ///
5358 /// This helps prevent bugs due to typos, such as:
5359 /// if (condition);
5360 /// do_stuff();
5362 const Stmt *Body,
5363 unsigned DiagID);
5364
5365 /// Warn if a for/while loop statement \p S, which is followed by
5366 /// \p PossibleBody, has a suspicious null statement as a body.
5367 void DiagnoseEmptyLoopBody(const Stmt *S,
5368 const Stmt *PossibleBody);
5369
5370 /// Warn if a value is moved to itself.
5371 void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
5372 SourceLocation OpLoc);
5373
5374 /// Returns a field in a CXXRecordDecl that has the same name as the decl \p
5375 /// SelfAssigned when inside a CXXMethodDecl.
5376 const FieldDecl *
5378
5379 /// Warn if we're implicitly casting from a _Nullable pointer type to a
5380 /// _Nonnull one.
5382 SourceLocation Loc);
5383
5384 /// Warn when implicitly casting 0 to nullptr.
5385 void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E);
5386
5391
5394 ParsingClassDepth++;
5396 }
5398 ParsingClassDepth--;
5400 }
5401
5403
5405 const ObjCInterfaceDecl *UnknownObjCClass,
5406 bool ObjCPropertyAccess,
5407 bool AvoidPartialAvailabilityChecks = false,
5408 ObjCInterfaceDecl *ClassReceiver = nullptr);
5409
5411 UnavailableAttr::ImplicitReason reason);
5412
5413 /// Issue any -Wunguarded-availability warnings in \c FD
5415
5417
5418 //===--------------------------------------------------------------------===//
5419 // Expression Parsing Callbacks: SemaExpr.cpp.
5420
5421 bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
5422 // A version of DiagnoseUseOfDecl that should be used if overload resolution
5423 // has been used to find this declaration, which means we don't have to bother
5424 // checking the trailing requires clause.
5426 return DiagnoseUseOfDecl(
5427 D, Loc, /*UnknownObjCClass=*/nullptr, /*ObjCPropertyAccess=*/false,
5428 /*AvoidPartialAvailabilityChecks=*/false, /*ClassReceiver=*/nullptr,
5429 /*SkipTrailingRequiresClause=*/true);
5430 }
5431
5433 const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
5434 bool ObjCPropertyAccess = false,
5435 bool AvoidPartialAvailabilityChecks = false,
5436 ObjCInterfaceDecl *ClassReciever = nullptr,
5437 bool SkipTrailingRequiresClause = false);
5441 ObjCMethodDecl *Getter,
5442 SourceLocation Loc);
5444 ArrayRef<Expr *> Args);
5445
5447 ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
5452 ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t,
5456
5458
5462
5465
5467
5468 // Functions for marking a declaration referenced. These functions also
5469 // contain the relevant logic for marking if a reference to a function or
5470 // variable is an odr-use (in the C++11 sense). There are separate variants
5471 // for expressions referring to a decl; these exist because odr-use marking
5472 // needs to be delayed for some constant variables when we build one of the
5473 // named expressions.
5474 //
5475 // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
5476 // should usually be true. This only needs to be set to false if the lack of
5477 // odr-use cannot be determined from the current context (for instance,
5478 // because the name denotes a virtual function and was written without an
5479 // explicit nested-name-specifier).
5480 void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
5482 bool MightBeOdrUse = true);
5484 void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
5488 unsigned CapturingScopeIndex);
5489
5491 void CleanupVarDeclMarking();
5492
5496
5497 /// Try to capture the given variable.
5498 ///
5499 /// \param Var The variable to capture.
5500 ///
5501 /// \param Loc The location at which the capture occurs.
5502 ///
5503 /// \param Kind The kind of capture, which may be implicit (for either a
5504 /// block or a lambda), or explicit by-value or by-reference (for a lambda).
5505 ///
5506 /// \param EllipsisLoc The location of the ellipsis, if one is provided in
5507 /// an explicit lambda capture.
5508 ///
5509 /// \param BuildAndDiagnose Whether we are actually supposed to add the
5510 /// captures or diagnose errors. If false, this routine merely check whether
5511 /// the capture can occur without performing the capture itself or complaining
5512 /// if the variable cannot be captured.
5513 ///
5514 /// \param CaptureType Will be set to the type of the field used to capture
5515 /// this variable in the innermost block or lambda. Only valid when the
5516 /// variable can be captured.
5517 ///
5518 /// \param DeclRefType Will be set to the type of a reference to the capture
5519 /// from within the current scope. Only valid when the variable can be
5520 /// captured.
5521 ///
5522 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5523 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5524 /// This is useful when enclosing lambdas must speculatively capture
5525 /// variables that may or may not be used in certain specializations of
5526 /// a nested generic lambda.
5527 ///
5528 /// \returns true if an error occurred (i.e., the variable cannot be
5529 /// captured) and false if the capture succeeded.
5531 TryCaptureKind Kind, SourceLocation EllipsisLoc,
5532 bool BuildAndDiagnose, QualType &CaptureType,
5533 QualType &DeclRefType,
5534 const unsigned *const FunctionScopeIndexToStopAt);
5535
5536 /// Try to capture the given variable.
5539 SourceLocation EllipsisLoc = SourceLocation());
5540
5541 /// Checks if the variable must be captured.
5543
5544 /// Given a variable, determine the type that a reference to that
5545 /// variable will have in the given scope.
5547
5548 /// Mark all of the declarations referenced within a particular AST node as
5549 /// referenced. Used when template instantiation instantiates a non-dependent
5550 /// type -- entities referenced by the type are now referenced.
5553 Expr *E, bool SkipLocalVariables = false,
5554 ArrayRef<const Expr *> StopAt = std::nullopt);
5555
5556 /// Try to recover by turning the given expression into a
5557 /// call. Returns true if recovery was attempted or an error was
5558 /// emitted; this may also leave the ExprResult invalid.
5560 bool ForceComplain = false,
5561 bool (*IsPlausibleResult)(QualType) = nullptr);
5562
5563 /// Figure out if an expression could be turned into a call.
5564 bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
5565 UnresolvedSetImpl &NonTemplateOverloads);
5566
5567 /// Try to convert an expression \p E to type \p Ty. Returns the result of the
5568 /// conversion.
5570
5571 /// Conditionally issue a diagnostic based on the statements's reachability
5572 /// analysis.
5573 ///
5574 /// \param Stmts If Stmts is non-empty, delay reporting the diagnostic until
5575 /// the function body is parsed, and then do a basic reachability analysis to
5576 /// determine if the statement is reachable. If it is unreachable, the
5577 /// diagnostic will not be emitted.
5579 const PartialDiagnostic &PD);
5580
5581 /// Conditionally issue a diagnostic based on the current
5582 /// evaluation context.
5583 ///
5584 /// \param Statement If Statement is non-null, delay reporting the
5585 /// diagnostic until the function body is parsed, and then do a basic
5586 /// reachability analysis to determine if the statement is reachable.
5587 /// If it is unreachable, the diagnostic will not be emitted.
5588 bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
5589 const PartialDiagnostic &PD);
5590 /// Similar, but diagnostic is only produced if all the specified statements
5591 /// are reachable.
5593 const PartialDiagnostic &PD);
5594
5595 // Primary Expressions.
5596 SourceRange getExprRange(Expr *E) const;
5597
5599 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5600 UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
5601 CorrectionCandidateCallback *CCC = nullptr,
5602 bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
5603
5606 DeclarationNameInfo &NameInfo,
5607 const TemplateArgumentListInfo *&TemplateArgs);
5608
5610
5611 bool
5614 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
5615 ArrayRef<Expr *> Args = std::nullopt,
5616 TypoExpr **Out = nullptr);
5617
5619 IdentifierInfo *II);
5621
5623 IdentifierInfo *II,
5624 bool AllowBuiltinCreation=false);
5625
5627 SourceLocation TemplateKWLoc,
5628 const DeclarationNameInfo &NameInfo,
5629 bool isAddressOfOperand,
5630 const TemplateArgumentListInfo *TemplateArgs);
5631
5632 /// If \p D cannot be odr-used in the current expression evaluation context,
5633 /// return a reason explaining why. Otherwise, return NOUR_None.
5635
5637 SourceLocation Loc,
5638 const CXXScopeSpec *SS = nullptr);
5639 DeclRefExpr *
5641 const DeclarationNameInfo &NameInfo,
5642 const CXXScopeSpec *SS = nullptr,
5643 NamedDecl *FoundD = nullptr,
5644 SourceLocation TemplateKWLoc = SourceLocation(),
5645 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5646 DeclRefExpr *
5648 const DeclarationNameInfo &NameInfo,
5650 NamedDecl *FoundD = nullptr,
5651 SourceLocation TemplateKWLoc = SourceLocation(),
5652 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5653
5656 const CXXScopeSpec &SS,
5657 SourceLocation nameLoc,
5658 IndirectFieldDecl *indirectField,
5659 DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
5660 Expr *baseObjectExpr = nullptr,
5661 SourceLocation opLoc = SourceLocation());
5662
5664 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R,
5665 const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
5666 UnresolvedLookupExpr *AsULE = nullptr);
5668 SourceLocation TemplateKWLoc,
5669 LookupResult &R,
5670 const TemplateArgumentListInfo *TemplateArgs,
5671 bool IsDefiniteInstance,
5672 const Scope *S);
5674 const LookupResult &R,
5675 bool HasTrailingLParen);
5676
5679 const DeclarationNameInfo &NameInfo,
5680 bool IsAddressOfOperand, const Scope *S,
5681 TypeSourceInfo **RecoveryTSI = nullptr);
5682
5684 SourceLocation TemplateKWLoc,
5685 const DeclarationNameInfo &NameInfo,
5686 const TemplateArgumentListInfo *TemplateArgs);
5687
5689 LookupResult &R,
5690 bool NeedsADL,
5691 bool AcceptInvalidDecl = false);
5693 const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
5694 NamedDecl *FoundD = nullptr,
5695 const TemplateArgumentListInfo *TemplateArgs = nullptr,
5696 bool AcceptInvalidDecl = false);
5697
5699 DeclarationNameInfo &SuffixInfo,
5700 ArrayRef<Expr *> Args,
5701 SourceLocation LitEndLoc,
5702 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
5703
5708
5710 SourceLocation LParen,
5711 SourceLocation RParen,
5712 TypeSourceInfo *TSI);
5714 SourceLocation LParen,
5715 SourceLocation RParen,
5716 ParsedType ParsedTy);
5717
5719
5720 ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
5722 Scope *UDLScope = nullptr);
5726 MultiExprArg Val);
5727
5728 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
5729 /// fragments (e.g. "foo" "bar" L"baz").
5731 Scope *UDLScope = nullptr);
5732
5734
5735 /// ControllingExprOrType is either an opaque pointer coming out of a
5736 /// ParsedType or an Expr *. FIXME: it'd be better to split this interface
5737 /// into two so we don't take a void *, but that's awkward because one of
5738 /// the operands is either a ParsedType or an Expr *, which doesn't lend
5739 /// itself to generic code very well.
5741 SourceLocation DefaultLoc,
5742 SourceLocation RParenLoc,
5743 bool PredicateIsExpr,
5744 void *ControllingExprOrType,
5745 ArrayRef<ParsedType> ArgTypes,
5746 ArrayRef<Expr *> ArgExprs);
5747 /// ControllingExprOrType is either a TypeSourceInfo * or an Expr *. FIXME:
5748 /// it'd be better to split this interface into two so we don't take a
5749 /// void *, but see the FIXME on ActOnGenericSelectionExpr as to why that
5750 /// isn't a trivial change.
5752 SourceLocation DefaultLoc,
5753 SourceLocation RParenLoc,
5754 bool PredicateIsExpr,
5755 void *ControllingExprOrType,
5757 ArrayRef<Expr *> Exprs);
5758
5759 // Binary/Unary Operators. 'Tok' is the token for the operator.
5761 Expr *InputExpr, bool IsAfterAmp = false);
5763 Expr *Input, bool IsAfterAmp = false);
5765 Expr *Input, bool IsAfterAmp = false);
5766
5769
5770 bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N);
5771
5772 bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty,
5773 SourceLocation OpLoc, SourceRange R);
5774 bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo,
5775 SourceLocation OpLoc, SourceRange R);
5776
5778 SourceLocation OpLoc,
5779 UnaryExprOrTypeTrait ExprKind,
5780 SourceRange R);
5782 UnaryExprOrTypeTrait ExprKind);
5785 UnaryExprOrTypeTrait ExprKind,
5786 bool IsType, void *TyOrEx,
5787 SourceRange ArgRange);
5788
5790 bool CheckVecStepExpr(Expr *E);
5791
5794 SourceRange ExprRange,
5795 UnaryExprOrTypeTrait ExprKind,
5796 StringRef KWName);
5798 SourceLocation OpLoc,
5799 IdentifierInfo &Name,
5800 SourceLocation NameLoc,
5801 SourceLocation RParenLoc);
5803 tok::TokenKind Kind, Expr *Input);
5804
5806 MultiExprArg ArgExprs,
5807 SourceLocation RLoc);
5809 Expr *Idx, SourceLocation RLoc);
5810
5812 Expr *ColumnIdx,
5813 SourceLocation RBLoc);
5814
5816 Expr *LowerBound,
5817 SourceLocation ColonLocFirst,
5818 SourceLocation ColonLocSecond,
5819 Expr *Length, Expr *Stride,
5820 SourceLocation RBLoc);
5822 SourceLocation RParenLoc,
5823 ArrayRef<Expr *> Dims,
5824 ArrayRef<SourceRange> Brackets);
5825
5826 /// Data structure for iterator expression.
5836
5838 SourceLocation LLoc, SourceLocation RLoc,
5840
5841 // This struct is for use by ActOnMemberAccess to allow
5842 // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
5843 // changing the access operator from a '.' to a '->' (to see if that is the
5844 // change needed to fix an error about an unknown member, e.g. when the class
5845 // defines a custom operator->).
5851
5853 Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
5854 CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5855 NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
5856 const TemplateArgumentListInfo *TemplateArgs,
5857 const Scope *S,
5858 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5859
5862 bool IsArrow, const CXXScopeSpec &SS,
5863 SourceLocation TemplateKWLoc,
5864 NamedDecl *FirstQualifierInScope, LookupResult &R,
5865 const TemplateArgumentListInfo *TemplateArgs,
5866 const Scope *S,
5867 bool SuppressQualifierCheck = false,
5868 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5869
5870 ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
5871 SourceLocation OpLoc,
5872 const CXXScopeSpec &SS, FieldDecl *Field,
5873 DeclAccessPair FoundDecl,
5874 const DeclarationNameInfo &MemberNameInfo);
5875
5877
5878 bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
5879 const CXXScopeSpec &SS,
5880 const LookupResult &R);
5881
5883 bool IsArrow, SourceLocation OpLoc,
5884 const CXXScopeSpec &SS,
5885 SourceLocation TemplateKWLoc,
5886 NamedDecl *FirstQualifierInScope,
5887 const DeclarationNameInfo &NameInfo,
5888 const TemplateArgumentListInfo *TemplateArgs);
5889
5891 SourceLocation OpLoc,
5892 tok::TokenKind OpKind,
5893 CXXScopeSpec &SS,
5894 SourceLocation TemplateKWLoc,
5896 Decl *ObjCImpDecl);
5897
5898 MemberExpr *
5899 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5900 const CXXScopeSpec *SS, SourceLocation TemplateKWLoc,
5901 ValueDecl *Member, DeclAccessPair FoundDecl,
5902 bool HadMultipleCandidates,
5903 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5905 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5906 MemberExpr *
5907 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5908 NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
5909 ValueDecl *Member, DeclAccessPair FoundDecl,
5910 bool HadMultipleCandidates,
5911 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5913 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5914
5915 void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
5916 bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
5917 FunctionDecl *FDecl,
5918 const FunctionProtoType *Proto,
5919 ArrayRef<Expr *> Args,
5920 SourceLocation RParenLoc,
5921 bool ExecConfig = false);
5923 ParmVarDecl *Param,
5924 const Expr *ArgExpr);
5925
5926 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
5927 /// This provides the location of the left/right parens and a list of comma
5928 /// locations.
5930 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5931 Expr *ExecConfig = nullptr);
5933 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5934 Expr *ExecConfig = nullptr,
5935 bool IsExecConfig = false,
5936 bool AllowRecovery = false);
5938 MultiExprArg CallArgs);
5939 enum class AtomicArgumentOrder { API, AST };
5941 BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
5942 SourceLocation RParenLoc, MultiExprArg Args,
5946 BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc,
5947 ArrayRef<Expr *> Arg, SourceLocation RParenLoc,
5948 Expr *Config = nullptr, bool IsExecConfig = false,
5949 ADLCallKind UsesADL = ADLCallKind::NotADL);
5950
5952 MultiExprArg ExecConfig,
5953 SourceLocation GGGLoc);
5954
5956 Declarator &D, ParsedType &Ty,
5957 SourceLocation RParenLoc, Expr *CastExpr);
5959 TypeSourceInfo *Ty,
5960 SourceLocation RParenLoc,
5961 Expr *Op);
5963
5964 /// Build an altivec or OpenCL literal.
5966 SourceLocation RParenLoc, Expr *E,
5967 TypeSourceInfo *TInfo);
5968
5970
5972 ParsedType Ty,
5973 SourceLocation RParenLoc,
5974 Expr *InitExpr);
5975
5977 TypeSourceInfo *TInfo,
5978 SourceLocation RParenLoc,
5979 Expr *LiteralExpr);
5980
5982 MultiExprArg InitArgList,
5983 SourceLocation RBraceLoc);
5984
5986 MultiExprArg InitArgList,
5987 SourceLocation RBraceLoc);
5988
5990 SourceLocation EqualOrColonLoc,
5991 bool GNUSyntax,
5992 ExprResult Init);
5993
5994private:
5995 static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
5996
5997public:
5999 tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
6001 BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
6003 Expr *LHSExpr, Expr *RHSExpr);
6005 UnresolvedSetImpl &Functions);
6006
6007 void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
6008
6009 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
6010 /// in the case of a the GNU conditional expr extension.
6012 SourceLocation ColonLoc,
6013 Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
6014
6015 /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
6017 LabelDecl *TheDecl);
6018
6019 void ActOnStartStmtExpr();
6020 ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt,
6021 SourceLocation RPLoc);
6023 SourceLocation RPLoc, unsigned TemplateDepth);
6024 // Handle the final expression in a statement expression.
6026 void ActOnStmtExprError();
6027
6028 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
6031 bool isBrackets; // true if [expr], false if .ident
6032 union {
6035 } U;
6036 };
6037
6038 /// __builtin_offsetof(type, a.b[123][456].c)
6040 TypeSourceInfo *TInfo,
6041 ArrayRef<OffsetOfComponent> Components,
6042 SourceLocation RParenLoc);
6044 SourceLocation BuiltinLoc,
6046 ParsedType ParsedArgTy,
6047 ArrayRef<OffsetOfComponent> Components,
6048 SourceLocation RParenLoc);
6049
6050 // __builtin_choose_expr(constExpr, expr1, expr2)
6052 Expr *CondExpr, Expr *LHSExpr,
6053 Expr *RHSExpr, SourceLocation RPLoc);
6054
6055 // __builtin_va_arg(expr, type)
6057 SourceLocation RPLoc);
6059 TypeSourceInfo *TInfo, SourceLocation RPLoc);
6060
6061 // __builtin_LINE(), __builtin_FUNCTION(), __builtin_FUNCSIG(),
6062 // __builtin_FILE(), __builtin_COLUMN(), __builtin_source_location()
6064 SourceLocation BuiltinLoc,
6065 SourceLocation RPLoc);
6066
6067 // Build a potentially resolved SourceLocExpr.
6069 QualType ResultTy, SourceLocation BuiltinLoc,
6070 SourceLocation RPLoc,
6071 DeclContext *ParentContext);
6072
6073 // __null
6075
6076 bool CheckCaseExpression(Expr *E);
6077
6078 /// Describes the result of an "if-exists" condition check.
6080 /// The symbol exists.
6082
6083 /// The symbol does not exist.
6085
6086 /// The name is a dependent name, so the results will differ
6087 /// from one instantiation to the next.
6089
6090 /// An error occurred.
6091 IER_Error
6093
6096 const DeclarationNameInfo &TargetNameInfo);
6097
6100 bool IsIfExists, CXXScopeSpec &SS,
6101 UnqualifiedId &Name);
6102
6104 bool IsIfExists,
6105 NestedNameSpecifierLoc QualifierLoc,
6106 DeclarationNameInfo NameInfo,
6107 Stmt *Nested);
6109 bool IsIfExists,
6110 CXXScopeSpec &SS, UnqualifiedId &Name,
6111 Stmt *Nested);
6112
6113 //===------------------------- "Block" Extension ------------------------===//
6114
6115 /// ActOnBlockStart - This callback is invoked when a block literal is
6116 /// started.
6117 void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
6118
6119 /// ActOnBlockArguments - This callback allows processing of block arguments.
6120 /// If there are no arguments, this is still invoked.
6121 void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
6122 Scope *CurScope);
6123
6124 /// ActOnBlockError - If there is an error parsing a block, this callback
6125 /// is invoked to pop the information about the block from the action impl.
6126 void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
6127
6128 /// ActOnBlockStmtExpr - This is called when the body of a block statement
6129 /// literal was successfully completed. ^(int x){...}
6131 Scope *CurScope);
6132
6133 //===---------------------------- Clang Extensions ----------------------===//
6134
6135 /// __builtin_convertvector(...)
6137 SourceLocation BuiltinLoc,
6138 SourceLocation RParenLoc);
6139
6140 //===---------------------------- OpenCL Features -----------------------===//
6141
6142 /// __builtin_astype(...)
6143 ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
6144 SourceLocation BuiltinLoc,
6145 SourceLocation RParenLoc);
6147 SourceLocation BuiltinLoc,
6148 SourceLocation RParenLoc);
6149
6150 //===---------------------------- HLSL Features -------------------------===//
6151 Decl *ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer,
6152 SourceLocation KwLoc, IdentifierInfo *Ident,
6153 SourceLocation IdentLoc, SourceLocation LBrace);
6154 void ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace);
6155
6156 //===---------------------------- C++ Features --------------------------===//
6157
6158 // Act on C++ namespaces
6160 SourceLocation NamespaceLoc,
6161 SourceLocation IdentLoc, IdentifierInfo *Ident,
6162 SourceLocation LBrace,
6163 const ParsedAttributesView &AttrList,
6164 UsingDirectiveDecl *&UsingDecl, bool IsNested);
6165 void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
6166
6169
6171 EnumDecl *getStdAlignValT() const;
6172
6173private:
6174 // A cache representing if we've fully checked the various comparison category
6175 // types stored in ASTContext. The bit-index corresponds to the integer value
6176 // of a ComparisonCategoryType enumerator.
6177 llvm::SmallBitVector FullyCheckedComparisonCategories;
6178
6179 ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
6180 CXXScopeSpec &SS,
6181 ParsedType TemplateTypeTy,
6182 IdentifierInfo *MemberOrBase);
6183
6184public:
6186 /// The '<=>' operator was used in an expression and a builtin operator
6187 /// was selected.
6189 /// A defaulted 'operator<=>' needed the comparison category. This
6190 /// typically only applies to 'std::strong_ordering', due to the implicit
6191 /// fallback return value.
6193 };
6194
6195 /// Lookup the specified comparison category types in the standard
6196 /// library, an check the VarDecls possibly returned by the operator<=>
6197 /// builtins for that type.
6198 ///
6199 /// \return The type of the comparison category type corresponding to the
6200 /// specified Kind, or a null type if an error occurs
6202 SourceLocation Loc,
6204
6205 /// Tests whether Ty is an instance of std::initializer_list and, if
6206 /// it is and Element is not NULL, assigns the element type to Element.
6207 bool isStdInitializerList(QualType Ty, QualType *Element);
6208
6209 /// Looks for the std::initializer_list template and instantiates it
6210 /// with Element, or emits an error if it's not found.
6211 ///
6212 /// \returns The instantiated template, or null on error.
6214
6215 /// Determine whether Ctor is an initializer-list constructor, as
6216 /// defined in [dcl.init.list]p2.
6217 bool isInitListConstructor(const FunctionDecl *Ctor);
6218
6219 Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc,
6220 SourceLocation NamespcLoc, CXXScopeSpec &SS,
6221 SourceLocation IdentLoc,
6222 IdentifierInfo *NamespcName,
6223 const ParsedAttributesView &AttrList);
6224
6226
6228 SourceLocation NamespaceLoc,
6229 SourceLocation AliasLoc,
6230 IdentifierInfo *Alias,
6231 CXXScopeSpec &SS,
6232 SourceLocation IdentLoc,
6233 IdentifierInfo *Ident);
6234
6235 void FilterUsingLookup(Scope *S, LookupResult &lookup);
6236 void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
6237 bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target,
6238 const LookupResult &PreviousDecls,
6239 UsingShadowDecl *&PrevShadow);
6241 NamedDecl *Target,
6242 UsingShadowDecl *PrevDecl);
6243
6245 bool HasTypenameKeyword,
6246 const CXXScopeSpec &SS,
6247 SourceLocation NameLoc,
6248 const LookupResult &Previous);
6249 bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename,
6250 const CXXScopeSpec &SS,
6251 const DeclarationNameInfo &NameInfo,
6252 SourceLocation NameLoc,
6253 const LookupResult *R = nullptr,
6254 const UsingDecl *UD = nullptr);
6255
6257 Scope *S, AccessSpecifier AS, SourceLocation UsingLoc,
6258 bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS,
6259 DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc,
6260 const ParsedAttributesView &AttrList, bool IsInstantiation,
6261 bool IsUsingIfExists);
6263 SourceLocation UsingLoc,
6264 SourceLocation EnumLoc,
6265 SourceLocation NameLoc,
6266 TypeSourceInfo *EnumType, EnumDecl *ED);
6267 NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
6268 ArrayRef<NamedDecl *> Expansions);
6269
6271
6272 /// Given a derived-class using shadow declaration for a constructor and the
6273 /// correspnding base class constructor, find or create the implicit
6274 /// synthesized derived class constructor to use for this initialization.
6277 ConstructorUsingShadowDecl *DerivedShadow);
6278
6280 SourceLocation UsingLoc,
6281 SourceLocation TypenameLoc, CXXScopeSpec &SS,
6282 UnqualifiedId &Name, SourceLocation EllipsisLoc,
6283 const ParsedAttributesView &AttrList);
6285 SourceLocation UsingLoc,
6286 SourceLocation EnumLoc,
6287 SourceLocation IdentLoc, IdentifierInfo &II,
6288 CXXScopeSpec *SS = nullptr);
6290 MultiTemplateParamsArg TemplateParams,
6291 SourceLocation UsingLoc, UnqualifiedId &Name,
6292 const ParsedAttributesView &AttrList,
6293 TypeResult Type, Decl *DeclFromDeclSpec);
6294
6295 /// BuildCXXConstructExpr - Creates a complete call to a constructor,
6296 /// including handling of its default argument expressions.
6297 ///
6298 /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
6300 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6301 NamedDecl *FoundDecl,
6302 CXXConstructorDecl *Constructor, MultiExprArg Exprs,
6303 bool HadMultipleCandidates, bool IsListInitialization,
6304 bool IsStdInitListInitialization,
6305 bool RequiresZeroInit, unsigned ConstructKind,
6306 SourceRange ParenRange);
6307
6308 /// Build a CXXConstructExpr whose constructor has already been resolved if
6309 /// it denotes an inherited constructor.
6311 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6312 CXXConstructorDecl *Constructor, bool Elidable,
6313 MultiExprArg Exprs,
6314 bool HadMultipleCandidates, bool IsListInitialization,
6315 bool IsStdInitListInitialization,
6316 bool RequiresZeroInit, unsigned ConstructKind,
6317 SourceRange ParenRange);
6318
6319 // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
6320 // the constructor can be elidable?
6322 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6323 NamedDecl *FoundDecl,
6324 CXXConstructorDecl *Constructor, bool Elidable,
6325 MultiExprArg Exprs, bool HadMultipleCandidates,
6326 bool IsListInitialization,
6327 bool IsStdInitListInitialization, bool RequiresZeroInit,
6328 unsigned ConstructKind, SourceRange ParenRange);
6329
6331 SourceLocation InitLoc);
6332
6334
6335
6336 /// Instantiate or parse a C++ default argument expression as necessary.
6337 /// Return true on error.
6339 ParmVarDecl *Param, Expr *Init = nullptr,
6340 bool SkipImmediateInvocations = true);
6341
6342 /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
6343 /// the default expr if needed.
6345 ParmVarDecl *Param, Expr *Init = nullptr);
6346
6347 /// FinalizeVarWithDestructor - Prepare for calling destructor on the
6348 /// constructed variable.
6349 void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
6350
6351 /// Helper class that collects exception specifications for
6352 /// implicitly-declared special member functions.
6354 // Pointer to allow copying
6355 Sema *Self;
6356 // We order exception specifications thus:
6357 // noexcept is the most restrictive, but is only used in C++11.
6358 // throw() comes next.
6359 // Then a throw(collected exceptions)
6360 // Finally no specification, which is expressed as noexcept(false).
6361 // throw(...) is used instead if any called function uses it.
6362 ExceptionSpecificationType ComputedEST;
6363 llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
6364 SmallVector<QualType, 4> Exceptions;
6365
6366 void ClearExceptions() {
6367 ExceptionsSeen.clear();
6368 Exceptions.clear();
6369 }
6370
6371 public:
6373 : Self(&Self), ComputedEST(EST_BasicNoexcept) {
6374 if (!Self.getLangOpts().CPlusPlus11)
6375 ComputedEST = EST_DynamicNone;
6376 }
6377
6378 /// Get the computed exception specification type.
6380 assert(!isComputedNoexcept(ComputedEST) &&
6381 "noexcept(expr) should not be a possible result");
6382 return ComputedEST;
6383 }
6384
6385 /// The number of exceptions in the exception specification.
6386 unsigned size() const { return Exceptions.size(); }
6387
6388 /// The set of exceptions in the exception specification.
6389 const QualType *data() const { return Exceptions.data(); }
6390
6391 /// Integrate another called method into the collected data.
6392 void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
6393
6394 /// Integrate an invoked expression into the collected data.
6395 void CalledExpr(Expr *E) { CalledStmt(E); }
6396
6397 /// Integrate an invoked statement into the collected data.
6398 void CalledStmt(Stmt *S);
6399
6400 /// Overwrite an EPI's exception specification with this
6401 /// computed exception specification.
6404 ESI.Type = getExceptionSpecType();
6405 if (ESI.Type == EST_Dynamic) {
6406 ESI.Exceptions = Exceptions;
6407 } else if (ESI.Type == EST_None) {
6408 /// C++11 [except.spec]p14:
6409 /// The exception-specification is noexcept(false) if the set of
6410 /// potential exceptions of the special member function contains "any"
6411 ESI.Type = EST_NoexceptFalse;
6413 tok::kw_false).get();
6414 }
6415 return ESI;
6416 }
6417 };
6418
6419 /// Evaluate the implicit exception specification for a defaulted
6420 /// special member function.
6422
6423 /// Check the given noexcept-specifier, convert its expression, and compute
6424 /// the appropriate ExceptionSpecificationType.
6425 ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr,
6427
6428 /// Check the given exception-specification and update the
6429 /// exception specification information with the results.
6430 void checkExceptionSpecification(bool IsTopLevel,
6432 ArrayRef<ParsedType> DynamicExceptions,
6433 ArrayRef<SourceRange> DynamicExceptionRanges,
6434 Expr *NoexceptExpr,
6435 SmallVectorImpl<QualType> &Exceptions,
6437
6438 /// Determine if we're in a case where we need to (incorrectly) eagerly
6439 /// parse an exception specification to work around a libstdc++ bug.
6441
6442 /// Add an exception-specification to the given member function
6443 /// (or member function template). The exception-specification was parsed
6444 /// after the method itself was declared.
6447 SourceRange SpecificationRange,
6448 ArrayRef<ParsedType> DynamicExceptions,
6449 ArrayRef<SourceRange> DynamicExceptionRanges,
6450 Expr *NoexceptExpr);
6451
6452 class InheritedConstructorInfo;
6453
6454 /// Determine if a special member function should have a deleted
6455 /// definition when it is defaulted.
6456 bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
6457 InheritedConstructorInfo *ICI = nullptr,
6458 bool Diagnose = false);
6459
6460 /// Produce notes explaining why a defaulted function was defined as deleted.
6462
6463 /// Declare the implicit default constructor for the given class.
6464 ///
6465 /// \param ClassDecl The class declaration into which the implicit
6466 /// default constructor will be added.
6467 ///
6468 /// \returns The implicitly-declared default constructor.
6470 CXXRecordDecl *ClassDecl);
6471
6472 /// DefineImplicitDefaultConstructor - Checks for feasibility of
6473 /// defining this constructor as the default constructor.
6475 CXXConstructorDecl *Constructor);
6476
6477 /// Declare the implicit destructor for the given class.
6478 ///
6479 /// \param ClassDecl The class declaration into which the implicit
6480 /// destructor will be added.
6481 ///
6482 /// \returns The implicitly-declared destructor.
6484
6485 /// DefineImplicitDestructor - Checks for feasibility of
6486 /// defining this destructor as the default destructor.
6487 void DefineImplicitDestructor(SourceLocation CurrentLocation,
6488 CXXDestructorDecl *Destructor);
6489
6490 /// Build an exception spec for destructors that don't have one.
6491 ///
6492 /// C++11 says that user-defined destructors with no exception spec get one
6493 /// that looks as if the destructor was implicitly declared.
6495
6496 /// Define the specified inheriting constructor.
6498 CXXConstructorDecl *Constructor);
6499
6500 /// Declare the implicit copy constructor for the given class.
6501 ///
6502 /// \param ClassDecl The class declaration into which the implicit
6503 /// copy constructor will be added.
6504 ///
6505 /// \returns The implicitly-declared copy constructor.
6507
6508 /// DefineImplicitCopyConstructor - Checks for feasibility of
6509 /// defining this constructor as the copy constructor.
6510 void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
6511 CXXConstructorDecl *Constructor);
6512
6513 /// Declare the implicit move constructor for the given class.
6514 ///
6515 /// \param ClassDecl The Class declaration into which the implicit
6516 /// move constructor will be added.
6517 ///
6518 /// \returns The implicitly-declared move constructor, or NULL if it wasn't
6519 /// declared.
6521
6522 /// DefineImplicitMoveConstructor - Checks for feasibility of
6523 /// defining this constructor as the move constructor.
6524 void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
6525 CXXConstructorDecl *Constructor);
6526
6527 /// Declare the implicit copy assignment operator for the given class.
6528 ///
6529 /// \param ClassDecl The class declaration into which the implicit
6530 /// copy assignment operator will be added.
6531 ///
6532 /// \returns The implicitly-declared copy assignment operator.
6534
6535 /// Defines an implicitly-declared copy assignment operator.
6536 void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
6537 CXXMethodDecl *MethodDecl);
6538
6539 /// Declare the implicit move assignment operator for the given class.
6540 ///
6541 /// \param ClassDecl The Class declaration into which the implicit
6542 /// move assignment operator will be added.
6543 ///
6544 /// \returns The implicitly-declared move assignment operator, or NULL if it
6545 /// wasn't declared.
6547
6548 /// Defines an implicitly-declared move assignment operator.
6549 void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
6550 CXXMethodDecl *MethodDecl);
6551
6552 /// Force the declaration of any implicitly-declared members of this
6553 /// class.
6555
6556 /// Check a completed declaration of an implicit special member.
6558
6559 /// Determine whether the given function is an implicitly-deleted
6560 /// special member function.
6562
6563 /// Check whether 'this' shows up in the type of a static member
6564 /// function after the (naturally empty) cv-qualifier-seq would be.
6565 ///
6566 /// \returns true if an error occurred.
6568
6569 /// Whether this' shows up in the exception specification of a static
6570 /// member function.
6572
6573 /// Check whether 'this' shows up in the attributes of the given
6574 /// static member function.
6575 ///
6576 /// \returns true if an error occurred.
6578
6579 /// MaybeBindToTemporary - If the passed in expression has a record type with
6580 /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
6581 /// it simply returns the passed in expression.
6583
6584 /// Wrap the expression in a ConstantExpr if it is a potential immediate
6585 /// invocation.
6587
6589 FunctionDecl *FD, const sema::FunctionScopeInfo *FSI);
6590
6592
6594
6596 QualType DeclInitType, MultiExprArg ArgsPtr,
6597 SourceLocation Loc,
6598 SmallVectorImpl<Expr *> &ConvertedArgs,
6599 bool AllowExplicit = false,
6600 bool IsListInitialization = false);
6601
6603 SourceLocation NameLoc,
6604 IdentifierInfo &Name);
6605
6607 Scope *S, CXXScopeSpec &SS,
6608 bool EnteringContext);
6610 IdentifierInfo &II, SourceLocation NameLoc,
6611 Scope *S, CXXScopeSpec &SS,
6612 ParsedType ObjectType,
6613 bool EnteringContext);
6614
6616 ParsedType ObjectType);
6617
6618 // Checks that reinterpret casts don't have undefined behavior.
6619 void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
6620 bool IsDereference, SourceRange Range);
6621
6622 // Checks that the vector type should be initialized from a scalar
6623 // by splatting the value rather than populating a single element.
6624 // This is the case for AltiVecVector types as well as with
6625 // AltiVecPixel and AltiVecBool when -faltivec-src-compat=xl is specified.
6626 bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy);
6627
6628 // Checks if the -faltivec-src-compat=gcc option is specified.
6629 // If so, AltiVecVector, AltiVecBool and AltiVecPixel types are
6630 // treated the same way as they are when trying to initialize
6631 // these vectors on gcc (an error is emitted).
6633 QualType SrcTy);
6634
6635 /// ActOnCXXNamedCast - Parse
6636 /// {dynamic,static,reinterpret,const,addrspace}_cast's.
6638 tok::TokenKind Kind,
6639 SourceLocation LAngleBracketLoc,
6640 Declarator &D,
6641 SourceLocation RAngleBracketLoc,
6642 SourceLocation LParenLoc,
6643 Expr *E,
6644 SourceLocation RParenLoc);
6645
6647 tok::TokenKind Kind,
6648 TypeSourceInfo *Ty,
6649 Expr *E,
6650 SourceRange AngleBrackets,
6651 SourceRange Parens);
6652
6654 ExprResult Operand,
6655 SourceLocation RParenLoc);
6656
6658 Expr *Operand, SourceLocation RParenLoc);
6659
6660 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6661 SourceLocation TypeidLoc,
6662 TypeSourceInfo *Operand,
6663 SourceLocation RParenLoc);
6664 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6665 SourceLocation TypeidLoc,
6666 Expr *Operand,
6667 SourceLocation RParenLoc);
6668
6669 /// ActOnCXXTypeid - Parse typeid( something ).
6671 SourceLocation LParenLoc, bool isType,
6672 void *TyOrExpr,
6673 SourceLocation RParenLoc);
6674
6675 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6676 SourceLocation TypeidLoc,
6677 TypeSourceInfo *Operand,
6678 SourceLocation RParenLoc);
6679 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6680 SourceLocation TypeidLoc,
6681 Expr *Operand,
6682 SourceLocation RParenLoc);
6683
6684 /// ActOnCXXUuidof - Parse __uuidof( something ).
6686 SourceLocation LParenLoc, bool isType,
6687 void *TyOrExpr,
6688 SourceLocation RParenLoc);
6689
6690 /// Handle a C++1z fold-expression: ( expr op ... op expr ).
6692 tok::TokenKind Operator,
6693 SourceLocation EllipsisLoc, Expr *RHS,
6694 SourceLocation RParenLoc);
6696 SourceLocation LParenLoc, Expr *LHS,
6697 BinaryOperatorKind Operator,
6698 SourceLocation EllipsisLoc, Expr *RHS,
6699 SourceLocation RParenLoc,
6700 std::optional<unsigned> NumExpansions);
6702 BinaryOperatorKind Operator);
6703
6704 //// ActOnCXXThis - Parse 'this' pointer.
6706
6707 /// Build a CXXThisExpr and mark it referenced in the current context.
6708 Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
6709 void MarkThisReferenced(CXXThisExpr *This);
6710
6711 /// Try to retrieve the type of the 'this' pointer.
6712 ///
6713 /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
6715
6716 /// When non-NULL, the C++ 'this' expression is allowed despite the
6717 /// current context not being a non-static member function. In such cases,
6718 /// this provides the type used for 'this'.
6720
6721 /// RAII object used to temporarily allow the C++ 'this' expression
6722 /// to be used, with the given qualifiers on the current class type.
6724 Sema &S;
6725 QualType OldCXXThisTypeOverride;
6726 bool Enabled;
6727
6728 public:
6729 /// Introduce a new scope where 'this' may be allowed (when enabled),
6730 /// using the given declaration (which is either a class template or a
6731 /// class) along with the given qualifiers.
6732 /// along with the qualifiers placed on '*this'.
6733 CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals,
6734 bool Enabled = true);
6735
6737 };
6738
6739 /// Make sure the value of 'this' is actually available in the current
6740 /// context, if it is a potentially evaluated context.
6741 ///
6742 /// \param Loc The location at which the capture of 'this' occurs.
6743 ///
6744 /// \param Explicit Whether 'this' is explicitly captured in a lambda
6745 /// capture list.
6746 ///
6747 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
6748 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
6749 /// This is useful when enclosing lambdas must speculatively capture
6750 /// 'this' that may or may not be used in certain specializations of
6751 /// a nested generic lambda (depending on whether the name resolves to
6752 /// a non-static member function or a static function).
6753 /// \return returns 'true' if failed, 'false' if success.
6754 bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
6755 bool BuildAndDiagnose = true,
6756 const unsigned *const FunctionScopeIndexToStopAt = nullptr,
6757 bool ByCopy = false);
6758
6759 /// Determine whether the given type is the type of *this that is used
6760 /// outside of the body of a member function for a type that is currently
6761 /// being defined.
6763
6764 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
6766
6767
6768 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
6770
6773 SourceLocation AtLoc, SourceLocation RParen);
6774
6775 /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
6777
6778 //// ActOnCXXThrow - Parse throw expressions.
6781 bool IsThrownVarInScope);
6782 bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
6783
6784 /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
6785 /// Can be interpreted either as function-style casting ("int(x)")
6786 /// or class type construction ("ClassType(x,y,z)")
6787 /// or creation of a value-initialized type ("int()").
6789 SourceLocation LParenOrBraceLoc,
6790 MultiExprArg Exprs,
6791 SourceLocation RParenOrBraceLoc,
6792 bool ListInitialization);
6793
6795 SourceLocation LParenLoc,
6796 MultiExprArg Exprs,
6797 SourceLocation RParenLoc,
6798 bool ListInitialization);
6799
6800 /// ActOnCXXNew - Parsed a C++ 'new' expression.
6801 ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
6802 SourceLocation PlacementLParen,
6803 MultiExprArg PlacementArgs,
6804 SourceLocation PlacementRParen,
6805 SourceRange TypeIdParens, Declarator &D,
6806 Expr *Initializer);
6808 BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen,
6809 MultiExprArg PlacementArgs, SourceLocation PlacementRParen,
6810 SourceRange TypeIdParens, QualType AllocType,
6811 TypeSourceInfo *AllocTypeInfo, std::optional<Expr *> ArraySize,
6812 SourceRange DirectInitRange, Expr *Initializer);
6813
6814 /// Determine whether \p FD is an aligned allocation or deallocation
6815 /// function that is unavailable.
6817
6818 /// Produce diagnostics if \p FD is an aligned allocation or deallocation
6819 /// function that is unavailable.
6821 SourceLocation Loc);
6822
6823 bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
6824 SourceRange R);
6825
6826 /// The scope in which to find allocation functions.
6828 /// Only look for allocation functions in the global scope.
6830 /// Only look for allocation functions in the scope of the
6831 /// allocated class.
6833 /// Look for allocation functions in both the global scope
6834 /// and in the scope of the allocated class.
6835 AFS_Both
6837
6838 /// Finds the overloads of operator new and delete that are appropriate
6839 /// for the allocation.
6841 AllocationFunctionScope NewScope,
6842 AllocationFunctionScope DeleteScope,
6843 QualType AllocType, bool IsArray,
6844 bool &PassAlignment, MultiExprArg PlaceArgs,
6845 FunctionDecl *&OperatorNew,
6846 FunctionDecl *&OperatorDelete,
6847 bool Diagnose = true);
6850 ArrayRef<QualType> Params);
6851
6853 DeclarationName Name, FunctionDecl *&Operator,
6854 bool Diagnose = true, bool WantSize = false,
6855 bool WantAligned = false);
6857 bool CanProvideSize,
6858 bool Overaligned,
6859 DeclarationName Name);
6861 CXXRecordDecl *RD);
6862
6863 /// ActOnCXXDelete - Parsed a C++ 'delete' expression
6865 bool UseGlobal, bool ArrayForm,
6866 Expr *Operand);
6868 bool IsDelete, bool CallCanBeVirtual,
6869 bool WarnOnNonAbstractTypes,
6870 SourceLocation DtorLoc);
6871
6873 Expr *Operand, SourceLocation RParen);
6875 SourceLocation RParen);
6876
6877 /// Parsed one of the type trait support pseudo-functions.
6880 SourceLocation RParenLoc);
6883 SourceLocation RParenLoc);
6884
6885 /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
6886 /// pseudo-functions.
6888 SourceLocation KWLoc,
6889 ParsedType LhsTy,
6890 Expr *DimExpr,
6891 SourceLocation RParen);
6892
6894 SourceLocation KWLoc,
6895 TypeSourceInfo *TSInfo,
6896 Expr *DimExpr,
6897 SourceLocation RParen);
6898
6899 /// ActOnExpressionTrait - Parsed one of the unary type trait support
6900 /// pseudo-functions.
6902 SourceLocation KWLoc,
6903 Expr *Queried,
6904 SourceLocation RParen);
6905
6907 SourceLocation KWLoc,
6908 Expr *Queried,
6909 SourceLocation RParen);
6910
6912 Expr *Base,
6913 SourceLocation OpLoc,
6914 tok::TokenKind OpKind,
6915 ParsedType &ObjectType,
6916 bool &MayBePseudoDestructor);
6917
6919 SourceLocation OpLoc,
6920 tok::TokenKind OpKind,
6921 const CXXScopeSpec &SS,
6922 TypeSourceInfo *ScopeType,
6923 SourceLocation CCLoc,
6924 SourceLocation TildeLoc,
6925 PseudoDestructorTypeStorage DestroyedType);
6926
6928 SourceLocation OpLoc,
6929 tok::TokenKind OpKind,
6930 CXXScopeSpec &SS,
6931 UnqualifiedId &FirstTypeName,
6932 SourceLocation CCLoc,
6933 SourceLocation TildeLoc,
6934 UnqualifiedId &SecondTypeName);
6935
6937 SourceLocation OpLoc,
6938 tok::TokenKind OpKind,
6939 SourceLocation TildeLoc,
6940 const DeclSpec& DS);
6941
6942 /// MaybeCreateExprWithCleanups - If the current full-expression
6943 /// requires any cleanups, surround it with a ExprWithCleanups node.
6944 /// Otherwise, just returns the passed-in expression.
6948
6951 bool BoundToLvalueReference);
6952
6953 ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
6954 return ActOnFinishFullExpr(
6955 Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
6956 }
6958 bool DiscardedValue, bool IsConstexpr = false,
6959 bool IsTemplateArgument = false);
6961
6962 // Marks SS invalid if it represents an incomplete type.
6964 // Complete an enum decl, maybe without a scope spec.
6966 CXXScopeSpec *SS = nullptr);
6967
6970 bool EnteringContext = false);
6973
6974 /// The parser has parsed a global nested-name-specifier '::'.
6975 ///
6976 /// \param CCLoc The location of the '::'.
6977 ///
6978 /// \param SS The nested-name-specifier, which will be updated in-place
6979 /// to reflect the parsed nested-name-specifier.
6980 ///
6981 /// \returns true if an error occurred, false otherwise.
6983
6984 /// The parser has parsed a '__super' nested-name-specifier.
6985 ///
6986 /// \param SuperLoc The location of the '__super' keyword.
6987 ///
6988 /// \param ColonColonLoc The location of the '::'.
6989 ///
6990 /// \param SS The nested-name-specifier, which will be updated in-place
6991 /// to reflect the parsed nested-name-specifier.
6992 ///
6993 /// \returns true if an error occurred, false otherwise.
6995 SourceLocation ColonColonLoc, CXXScopeSpec &SS);
6996
6998 bool *CanCorrect = nullptr);
7000
7001 /// Keeps information about an identifier in a nested-name-spec.
7002 ///
7004 /// The type of the object, if we're parsing nested-name-specifier in
7005 /// a member access expression.
7007
7008 /// The identifier preceding the '::'.
7010
7011 /// The location of the identifier.
7013
7014 /// The location of the '::'.
7016
7017 /// Creates info object for the most typical case.
7021 CCLoc(ColonColonLoc) {
7022 }
7023
7025 SourceLocation ColonColonLoc, QualType ObjectType)
7027 IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {
7028 }
7029 };
7030
7032 NestedNameSpecInfo &IdInfo,
7033 bool EnteringContext,
7034 CXXScopeSpec &SS,
7035 NamedDecl *ScopeLookupResult,
7036 bool ErrorRecoveryLookup,
7037 bool *IsCorrectedToColon = nullptr,
7038 bool OnlyNamespace = false);
7039
7040 /// The parser has parsed a nested-name-specifier 'identifier::'.
7041 ///
7042 /// \param S The scope in which this nested-name-specifier occurs.
7043 ///
7044 /// \param IdInfo Parser information about an identifier in the
7045 /// nested-name-spec.
7046 ///
7047 /// \param EnteringContext Whether we're entering the context nominated by
7048 /// this nested-name-specifier.
7049 ///
7050 /// \param SS The nested-name-specifier, which is both an input
7051 /// parameter (the nested-name-specifier before this type) and an
7052 /// output parameter (containing the full nested-name-specifier,
7053 /// including this new type).
7054 ///
7055 /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
7056 /// are allowed. The bool value pointed by this parameter is set to 'true'
7057 /// if the identifier is treated as if it was followed by ':', not '::'.
7058 ///
7059 /// \param OnlyNamespace If true, only considers namespaces in lookup.
7060 ///
7061 /// \returns true if an error occurred, false otherwise.
7063 NestedNameSpecInfo &IdInfo,
7064 bool EnteringContext,
7065 CXXScopeSpec &SS,
7066 bool *IsCorrectedToColon = nullptr,
7067 bool OnlyNamespace = false);
7068
7070
7072 const DeclSpec &DS,
7073 SourceLocation ColonColonLoc);
7074
7076 NestedNameSpecInfo &IdInfo,
7077 bool EnteringContext);
7078
7079 /// The parser has parsed a nested-name-specifier
7080 /// 'template[opt] template-name < template-args >::'.
7081 ///
7082 /// \param S The scope in which this nested-name-specifier occurs.
7083 ///
7084 /// \param SS The nested-name-specifier, which is both an input
7085 /// parameter (the nested-name-specifier before this type) and an
7086 /// output parameter (containing the full nested-name-specifier,
7087 /// including this new type).
7088 ///
7089 /// \param TemplateKWLoc the location of the 'template' keyword, if any.
7090 /// \param TemplateName the template name.
7091 /// \param TemplateNameLoc The location of the template name.
7092 /// \param LAngleLoc The location of the opening angle bracket ('<').
7093 /// \param TemplateArgs The template arguments.
7094 /// \param RAngleLoc The location of the closing angle bracket ('>').
7095 /// \param CCLoc The location of the '::'.
7096 ///
7097 /// \param EnteringContext Whether we're entering the context of the
7098 /// nested-name-specifier.
7099 ///
7100 ///
7101 /// \returns true if an error occurred, false otherwise.
7103 CXXScopeSpec &SS,
7104 SourceLocation TemplateKWLoc,
7106 SourceLocation TemplateNameLoc,
7107 SourceLocation LAngleLoc,
7108 ASTTemplateArgsPtr TemplateArgs,
7109 SourceLocation RAngleLoc,
7110 SourceLocation CCLoc,
7111 bool EnteringContext);
7112
7113 /// Given a C++ nested-name-specifier, produce an annotation value
7114 /// that the parser can use later to reconstruct the given
7115 /// nested-name-specifier.
7116 ///
7117 /// \param SS A nested-name-specifier.
7118 ///
7119 /// \returns A pointer containing all of the information in the
7120 /// nested-name-specifier \p SS.
7122
7123 /// Given an annotation pointer for a nested-name-specifier, restore
7124 /// the nested-name-specifier structure.
7125 ///
7126 /// \param Annotation The annotation pointer, produced by
7127 /// \c SaveNestedNameSpecifierAnnotation().
7128 ///
7129 /// \param AnnotationRange The source range corresponding to the annotation.
7130 ///
7131 /// \param SS The nested-name-specifier that will be updated with the contents
7132 /// of the annotation pointer.
7133 void RestoreNestedNameSpecifierAnnotation(void *Annotation,
7134 SourceRange AnnotationRange,
7135 CXXScopeSpec &SS);
7136
7137 bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
7138
7139 /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
7140 /// scope or nested-name-specifier) is parsed, part of a declarator-id.
7141 /// After this method is called, according to [C++ 3.4.3p3], names should be
7142 /// looked up in the declarator-id's scope, until the declarator is parsed and
7143 /// ActOnCXXExitDeclaratorScope is called.
7144 /// The 'SS' should be a non-empty valid CXXScopeSpec.
7146
7147 /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
7148 /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
7149 /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
7150 /// Used to indicate that names should revert to being looked up in the
7151 /// defining scope.
7153
7154 /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
7155 /// initializer for the declaration 'Dcl'.
7156 /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
7157 /// static data member of class X, names should be looked up in the scope of
7158 /// class X.
7160
7161 /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
7162 /// initializer for the declaration 'Dcl'.
7163 void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
7164
7165 /// Create a new lambda closure type.
7167 TypeSourceInfo *Info,
7168 unsigned LambdaDependencyKind,
7169 LambdaCaptureDefault CaptureDefault);
7170
7171 /// Number lambda for linkage purposes if necessary.
7173 std::optional<CXXRecordDecl::LambdaNumbering>
7174 NumberingOverride = std::nullopt);
7175
7176 /// Endow the lambda scope info with the relevant properties.
7177 void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
7178 SourceRange IntroducerRange,
7179 LambdaCaptureDefault CaptureDefault,
7180 SourceLocation CaptureDefaultLoc, bool ExplicitParams,
7181 bool Mutable);
7182
7184 CXXRecordDecl *Class);
7186 CXXMethodDecl *Method, SourceLocation LambdaLoc,
7187 SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
7188 TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
7190 bool HasExplicitResultType);
7191
7192 /// Perform initialization analysis of the init-capture and perform
7193 /// any implicit conversions such as an lvalue-to-rvalue conversion if
7194 /// not being used to initialize a reference.
7196 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7197 IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init) {
7199 Loc, ByRef, EllipsisLoc, std::nullopt, Id,
7200 InitKind != LambdaCaptureInitKind::CopyInit, Init));
7201 }
7203 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7204 std::optional<unsigned> NumExpansions, IdentifierInfo *Id,
7205 bool DirectInit, Expr *&Init);
7206
7207 /// Create a dummy variable within the declcontext of the lambda's
7208 /// call operator, for name lookup purposes for a lambda init capture.
7209 ///
7210 /// CodeGen handles emission of lambda captures, ignoring these dummy
7211 /// variables appropriately.
7213 SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
7214 IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx);
7215
7216 /// Add an init-capture to a lambda scope.
7217 void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef);
7218
7219 /// Note that we have finished the explicit captures for the
7220 /// given lambda.
7222
7223 /// Deduce a block or lambda's return type based on the return
7224 /// statements present in the body.
7226
7227 /// Once the Lambdas capture are known, we can start to create the closure,
7228 /// call operator method, and keep track of the captures.
7229 /// We do the capture lookup here, but they are not actually captured until
7230 /// after we know what the qualifiers of the call operator are.
7232 Scope *CurContext);
7233
7234 /// This is called after parsing the explicit template parameter list
7235 /// on a lambda (if it exists) in C++2a.
7237 SourceLocation LAngleLoc,
7238 ArrayRef<NamedDecl *> TParams,
7239 SourceLocation RAngleLoc,
7240 ExprResult RequiresClause);
7241
7243 SourceLocation MutableLoc);
7244
7246 Scope *LambdaScope,
7248
7249 /// ActOnStartOfLambdaDefinition - This is called just before we start
7250 /// parsing the body of a lambda; it analyzes the explicit captures and
7251 /// arguments, and sets up various data-structures for the body of the
7252 /// lambda.
7254 Declarator &ParamInfo, const DeclSpec &DS);
7255
7256 /// ActOnLambdaError - If there is an error parsing a lambda, this callback
7257 /// is invoked to pop the information about the lambda.
7258 void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
7259 bool IsInstantiation = false);
7260
7261 /// ActOnLambdaExpr - This is called when the body of a lambda expression
7262 /// was successfully completed.
7264 Scope *CurScope);
7265
7266 /// Does copying/destroying the captured variable have side effects?
7267 bool CaptureHasSideEffects(const sema::Capture &From);
7268
7269 /// Diagnose if an explicit lambda capture is unused. Returns true if a
7270 /// diagnostic is emitted.
7271 bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
7272 const sema::Capture &From);
7273
7274 /// Build a FieldDecl suitable to hold the given capture.
7276
7277 /// Initialize the given capture with a suitable expression.
7279 SourceLocation ImplicitCaptureLoc,
7280 bool IsOpenMPMapping = false);
7281
7282 /// Complete a lambda-expression having processed and attached the
7283 /// lambda body.
7286
7287 /// Get the return type to use for a lambda's conversion function(s) to
7288 /// function pointer type, given the type of the call operator.
7289 QualType
7291 CallingConv CC);
7292
7293 /// Define the "body" of the conversion from a lambda object to a
7294 /// function pointer.
7295 ///
7296 /// This routine doesn't actually define a sensible body; rather, it fills
7297 /// in the initialization expression needed to copy the lambda object into
7298 /// the block, and IR generation actually generates the real body of the
7299 /// block pointer conversion.
7301 SourceLocation CurrentLoc, CXXConversionDecl *Conv);
7302
7303 /// Define the "body" of the conversion from a lambda object to a
7304 /// block pointer.
7305 ///
7306 /// This routine doesn't actually define a sensible body; rather, it fills
7307 /// in the initialization expression needed to copy the lambda object into
7308 /// the block, and IR generation actually generates the real body of the
7309 /// block pointer conversion.
7311 CXXConversionDecl *Conv);
7312
7314 SourceLocation ConvLocation,
7315 CXXConversionDecl *Conv,
7316 Expr *Src);
7317
7318 /// Check whether the given expression is a valid constraint expression.
7319 /// A diagnostic is emitted if it is not, false is returned, and
7320 /// PossibleNonPrimary will be set to true if the failure might be due to a
7321 /// non-primary expression being used as an atomic constraint.
7322 bool CheckConstraintExpression(const Expr *CE, Token NextToken = Token(),
7323 bool *PossibleNonPrimary = nullptr,
7324 bool IsTrailingRequiresClause = false);
7325
7326private:
7327 /// Caches pairs of template-like decls whose associated constraints were
7328 /// checked for subsumption and whether or not the first's constraints did in
7329 /// fact subsume the second's.
7330 llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
7331 /// Caches the normalized associated constraints of declarations (concepts or
7332 /// constrained declarations). If an error occurred while normalizing the
7333 /// associated constraints of the template or concept, nullptr will be cached
7334 /// here.
7335 llvm::DenseMap<NamedDecl *, NormalizedConstraint *>
7336 NormalizationCache;
7337
7338 llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
7339 SatisfactionCache;
7340
7341 /// Introduce the instantiated function parameters into the local
7342 /// instantiation scope, and set the parameter names to those used
7343 /// in the template.
7344 bool addInstantiatedParametersToScope(
7345 FunctionDecl *Function, const FunctionDecl *PatternDecl,
7347 const MultiLevelTemplateArgumentList &TemplateArgs);
7348
7349 /// Introduce the instantiated captures of the lambda into the local
7350 /// instantiation scope.
7351 bool addInstantiatedCapturesToScope(
7352 FunctionDecl *Function, const FunctionDecl *PatternDecl,
7354 const MultiLevelTemplateArgumentList &TemplateArgs);
7355
7356 /// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
7357 /// the case of lambdas) set up the LocalInstantiationScope of the current
7358 /// function.
7359 bool SetupConstraintScope(
7360 FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
7362
7363 /// Used during constraint checking, sets up the constraint template argument
7364 /// lists, and calls SetupConstraintScope to set up the
7365 /// LocalInstantiationScope to have the proper set of ParVarDecls configured.
7366 std::optional<MultiLevelTemplateArgumentList>
7367 SetupConstraintCheckingTemplateArgumentsAndScope(
7368 FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
7370
7371private:
7372 // The current stack of constraint satisfactions, so we can exit-early.
7373 using SatisfactionStackEntryTy =
7374 std::pair<const NamedDecl *, llvm::FoldingSetNodeID>;
7376 SatisfactionStack;
7377
7378public:
7380 const llvm::FoldingSetNodeID &ID) {
7381 const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
7382 SatisfactionStack.emplace_back(Can, ID);
7383 }
7384
7385 void PopSatisfactionStackEntry() { SatisfactionStack.pop_back(); }
7386
7388 const llvm::FoldingSetNodeID &ID) const {
7389 const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
7390 return llvm::find(SatisfactionStack,
7391 SatisfactionStackEntryTy{Can, ID}) !=
7392 SatisfactionStack.end();
7393 }
7394
7395 // Resets the current SatisfactionStack for cases where we are instantiating
7396 // constraints as a 'side effect' of normal instantiation in a way that is not
7397 // indicative of recursive definition.
7400 BackupSatisfactionStack;
7401 Sema &SemaRef;
7402
7403 public:
7405 SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
7406 }
7407
7409 SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
7410 }
7411 };
7412
7415 SatisfactionStack.swap(NewSS);
7416 }
7417
7418 const NormalizedConstraint *
7420 NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
7421
7422 /// \brief Check whether the given declaration's associated constraints are
7423 /// at least as constrained than another declaration's according to the
7424 /// partial ordering of constraints.
7425 ///
7426 /// \param Result If no error occurred, receives the result of true if D1 is
7427 /// at least constrained than D2, and false otherwise.
7428 ///
7429 /// \returns true if an error occurred, false otherwise.
7432 bool &Result);
7433
7434 /// If D1 was not at least as constrained as D2, but would've been if a pair
7435 /// of atomic constraints involved had been declared in a concept and not
7436 /// repeated in two separate places in code.
7437 /// \returns true if such a diagnostic was emitted, false otherwise.
7440
7441 /// \brief Check whether the given list of constraint expressions are
7442 /// satisfied (as if in a 'conjunction') given template arguments.
7443 /// \param Template the template-like entity that triggered the constraints
7444 /// check (either a concept or a constrained entity).
7445 /// \param ConstraintExprs a list of constraint expressions, treated as if
7446 /// they were 'AND'ed together.
7447 /// \param TemplateArgLists the list of template arguments to substitute into
7448 /// the constraint expression.
7449 /// \param TemplateIDRange The source range of the template id that
7450 /// caused the constraints check.
7451 /// \param Satisfaction if true is returned, will contain details of the
7452 /// satisfaction, with enough information to diagnose an unsatisfied
7453 /// expression.
7454 /// \returns true if an error occurred and satisfaction could not be checked,
7455 /// false otherwise.
7457 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
7458 const MultiLevelTemplateArgumentList &TemplateArgLists,
7459 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction) {
7461 return CheckConstraintSatisfaction(Template, ConstraintExprs, Converted,
7462 TemplateArgLists, TemplateIDRange,
7463 Satisfaction);
7464 }
7465
7466 /// \brief Check whether the given list of constraint expressions are
7467 /// satisfied (as if in a 'conjunction') given template arguments.
7468 /// Additionally, takes an empty list of Expressions which is populated with
7469 /// the instantiated versions of the ConstraintExprs.
7470 /// \param Template the template-like entity that triggered the constraints
7471 /// check (either a concept or a constrained entity).
7472 /// \param ConstraintExprs a list of constraint expressions, treated as if
7473 /// they were 'AND'ed together.
7474 /// \param ConvertedConstraints a out parameter that will get populated with
7475 /// the instantiated version of the ConstraintExprs if we successfully checked
7476 /// satisfaction.
7477 /// \param TemplateArgList the multi-level list of template arguments to
7478 /// substitute into the constraint expression. This should be relative to the
7479 /// top-level (hence multi-level), since we need to instantiate fully at the
7480 /// time of checking.
7481 /// \param TemplateIDRange The source range of the template id that
7482 /// caused the constraints check.
7483 /// \param Satisfaction if true is returned, will contain details of the
7484 /// satisfaction, with enough information to diagnose an unsatisfied
7485 /// expression.
7486 /// \returns true if an error occurred and satisfaction could not be checked,
7487 /// false otherwise.
7489 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
7490 llvm::SmallVectorImpl<Expr *> &ConvertedConstraints,
7491 const MultiLevelTemplateArgumentList &TemplateArgList,
7492 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
7493
7494 /// \brief Check whether the given non-dependent constraint expression is
7495 /// satisfied. Returns false and updates Satisfaction with the satisfaction
7496 /// verdict if successful, emits a diagnostic and returns true if an error
7497 /// occurred and satisfaction could not be determined.
7498 ///
7499 /// \returns true if an error occurred, false otherwise.
7500 bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
7501 ConstraintSatisfaction &Satisfaction);
7502
7503 /// Check whether the given function decl's trailing requires clause is
7504 /// satisfied, if any. Returns false and updates Satisfaction with the
7505 /// satisfaction verdict if successful, emits a diagnostic and returns true if
7506 /// an error occurred and satisfaction could not be determined.
7507 ///
7508 /// \returns true if an error occurred, false otherwise.
7510 ConstraintSatisfaction &Satisfaction,
7511 SourceLocation UsageLoc = SourceLocation(),
7512 bool ForOverloadResolution = false);
7513
7514 /// \brief Ensure that the given template arguments satisfy the constraints
7515 /// associated with the given template, emitting a diagnostic if they do not.
7516 ///
7517 /// \param Template The template to which the template arguments are being
7518 /// provided.
7519 ///
7520 /// \param TemplateArgs The converted, canonicalized template arguments.
7521 ///
7522 /// \param TemplateIDRange The source range of the template id that
7523 /// caused the constraints check.
7524 ///
7525 /// \returns true if the constrains are not satisfied or could not be checked
7526 /// for satisfaction, false if the constraints are satisfied.
7528 TemplateDecl *Template,
7529 const MultiLevelTemplateArgumentList &TemplateArgs,
7530 SourceRange TemplateIDRange);
7531
7532 /// \brief Emit diagnostics explaining why a constraint expression was deemed
7533 /// unsatisfied.
7534 /// \param First whether this is the first time an unsatisfied constraint is
7535 /// diagnosed for this error.
7536 void
7538 bool First = true);
7539
7540 /// \brief Emit diagnostics explaining why a constraint expression was deemed
7541 /// unsatisfied.
7542 void
7544 bool First = true);
7545
7546 // ParseObjCStringLiteral - Parse Objective-C string literals.
7548 ArrayRef<Expr *> Strings);
7549
7551
7552 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
7553 /// numeric literal expression. Type of the expression will be "NSNumber *"
7554 /// or "id" if NSNumber is unavailable.
7557 bool Value);
7559
7560 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
7561 /// '@' prefixed parenthesized expression. The type of the expression will
7562 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
7563 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
7564 /// "const char *" or C structure with attribute 'objc_boxable'.
7566
7568 Expr *IndexExpr,
7569 ObjCMethodDecl *getterMethod,
7570 ObjCMethodDecl *setterMethod);
7571
7574
7576 TypeSourceInfo *EncodedTypeInfo,
7577 SourceLocation RParenLoc);
7579 CXXConversionDecl *Method,
7580 bool HadMultipleCandidates);
7581
7583 SourceLocation EncodeLoc,
7584 SourceLocation LParenLoc,
7585 ParsedType Ty,
7586 SourceLocation RParenLoc);
7587
7588 /// ParseObjCSelectorExpression - Build selector expression for \@selector
7590 SourceLocation AtLoc,
7591 SourceLocation SelLoc,
7592 SourceLocation LParenLoc,
7593 SourceLocation RParenLoc,
7594 bool WarnMultipleSelectors);
7595
7596 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
7598 SourceLocation AtLoc,
7599 SourceLocation ProtoLoc,
7600 SourceLocation LParenLoc,
7601 SourceLocation ProtoIdLoc,
7602 SourceLocation RParenLoc);
7603
7604 //===--------------------------------------------------------------------===//
7605 // C++ Declarations
7606 //
7608 SourceLocation ExternLoc,
7609 Expr *LangStr,
7610 SourceLocation LBraceLoc);
7612 Decl *LinkageSpec,
7613 SourceLocation RBraceLoc);
7614
7615
7616 //===--------------------------------------------------------------------===//
7617 // C++ Classes
7618 //
7620 bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
7621 const CXXScopeSpec *SS = nullptr);
7623
7625 SourceLocation ColonLoc,
7626 const ParsedAttributesView &Attrs);
7627
7629 Declarator &D,
7630 MultiTemplateParamsArg TemplateParameterLists,
7631 Expr *BitfieldWidth, const VirtSpecifiers &VS,
7632 InClassInitStyle InitStyle);
7633
7636 SourceLocation EqualLoc,
7637 Expr *Init);
7638
7640 Scope *S,
7641 CXXScopeSpec &SS,
7642 IdentifierInfo *MemberOrBase,
7643 ParsedType TemplateTypeTy,
7644 const DeclSpec &DS,
7645 SourceLocation IdLoc,
7646 SourceLocation LParenLoc,
7647 ArrayRef<Expr *> Args,
7648 SourceLocation RParenLoc,
7649 SourceLocation EllipsisLoc);
7650
7652 Scope *S,
7653 CXXScopeSpec &SS,
7654 IdentifierInfo *MemberOrBase,
7655 ParsedType TemplateTypeTy,
7656 const DeclSpec &DS,
7657 SourceLocation IdLoc,
7658 Expr *InitList,
7659 SourceLocation EllipsisLoc);
7660
7662 Scope *S,
7663 CXXScopeSpec &SS,
7664 IdentifierInfo *MemberOrBase,
7665 ParsedType TemplateTypeTy,
7666 const DeclSpec &DS,
7667 SourceLocation IdLoc,
7668 Expr *Init,
7669 SourceLocation EllipsisLoc);
7670
7672 Expr *Init,
7673 SourceLocation IdLoc);
7674
7676 TypeSourceInfo *BaseTInfo,
7677 Expr *Init,
7678 CXXRecordDecl *ClassDecl,
7679 SourceLocation EllipsisLoc);
7680
7682 Expr *Init,
7683 CXXRecordDecl *ClassDecl);
7684
7687
7689 CXXConstructorDecl *Constructor, bool AnyErrors,
7690 ArrayRef<CXXCtorInitializer *> Initializers = std::nullopt);
7691
7692 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
7693
7694
7695 /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
7696 /// mark all the non-trivial destructors of its members and bases as
7697 /// referenced.
7699 CXXRecordDecl *Record);
7700
7701 /// Mark destructors of virtual bases of this class referenced. In the Itanium
7702 /// C++ ABI, this is done when emitting a destructor for any non-abstract
7703 /// class. In the Microsoft C++ ABI, this is done any time a class's
7704 /// destructor is referenced.
7706 SourceLocation Location, CXXRecordDecl *ClassDecl,
7707 llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
7708
7709 /// Do semantic checks to allow the complete destructor variant to be emitted
7710 /// when the destructor is defined in another translation unit. In the Itanium
7711 /// C++ ABI, destructor variants are emitted together. In the MS C++ ABI, they
7712 /// can be emitted in separate TUs. To emit the complete variant, run a subset
7713 /// of the checks performed when emitting a regular destructor.
7715 CXXDestructorDecl *Dtor);
7716
7717 /// The list of classes whose vtables have been used within
7718 /// this translation unit, and the source locations at which the
7719 /// first use occurred.
7720 typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
7721
7722 /// The list of vtables that are required but have not yet been
7723 /// materialized.
7725
7726 /// The set of classes whose vtables have been used within
7727 /// this translation unit, and a bit that will be true if the vtable is
7728 /// required to be emitted (otherwise, it should be emitted only if needed
7729 /// by code generation).
7730 llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
7731
7732 /// Load any externally-stored vtable uses.
7734
7735 /// Note that the vtable for the given class was used at the
7736 /// given location.
7738 bool DefinitionRequired = false);
7739
7740 /// Mark the exception specifications of all virtual member functions
7741 /// in the given class as needed.
7743 const CXXRecordDecl *RD);
7744
7745 /// MarkVirtualMembersReferenced - Will mark all members of the given
7746 /// CXXRecordDecl referenced.
7748 bool ConstexprOnly = false);
7749
7750 /// Define all of the vtables that have been used in this
7751 /// translation unit and reference any virtual members used by those
7752 /// vtables.
7753 ///
7754 /// \returns true if any work was done, false otherwise.
7755 bool DefineUsedVTables();
7756
7758
7759 void ActOnMemInitializers(Decl *ConstructorDecl,
7760 SourceLocation ColonLoc,
7762 bool AnyErrors);
7763
7764 /// Check class-level dllimport/dllexport attribute. The caller must
7765 /// ensure that referenceDLLExportedClassMethods is called some point later
7766 /// when all outer classes of Class are complete.
7769
7771
7773 CXXRecordDecl *Class, Attr *ClassAttr,
7774 ClassTemplateSpecializationDecl *BaseTemplateSpec,
7775 SourceLocation BaseLoc);
7776
7777 /// Add gsl::Pointer attribute to std::container::iterator
7778 /// \param ND The declaration that introduces the name
7779 /// std::container::iterator. \param UnderlyingRecord The record named by ND.
7780 void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord);
7781
7782 /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
7784
7785 /// Add [[gsl::Pointer]] attributes for std:: types.
7787
7788 void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record);
7789
7790 /// Check that the C++ class annoated with "trivial_abi" satisfies all the
7791 /// conditions that are needed for the attribute to have an effect.
7793
7795 Decl *TagDecl, SourceLocation LBrac,
7796 SourceLocation RBrac,
7797 const ParsedAttributesView &AttrList);
7800
7802 unsigned ActOnReenterTemplateScope(Decl *Template,
7803 llvm::function_ref<Scope *()> EnterScope);
7806 void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
7811 CachedTokens &Toks);
7814
7815 bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result,
7816 ASTContext &Ctx,
7817 bool ErrorOnInvalidMessage);
7819 Expr *AssertExpr,
7820 Expr *AssertMessageExpr,
7821 SourceLocation RParenLoc);
7823 Expr *AssertExpr, Expr *AssertMessageExpr,
7824 SourceLocation RParenLoc, bool Failed);
7825 void DiagnoseStaticAssertDetails(const Expr *E);
7826
7828 SourceLocation FriendLoc,
7829 TypeSourceInfo *TSInfo);
7830 Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
7831 MultiTemplateParamsArg TemplateParams);
7833 MultiTemplateParamsArg TemplateParams);
7834
7836 StorageClass& SC);
7837 void CheckConstructor(CXXConstructorDecl *Constructor);
7839 StorageClass& SC);
7840 bool CheckDestructor(CXXDestructorDecl *Destructor);
7842 StorageClass& SC);
7845 StorageClass &SC);
7847
7849
7851 CXXSpecialMember CSM,
7852 SourceLocation DefaultLoc);
7854
7858 FunctionDecl *Spaceship);
7861
7862 //===--------------------------------------------------------------------===//
7863 // C++ Derived Classes
7864 //
7865
7866 /// ActOnBaseSpecifier - Parsed a base specifier
7868 SourceRange SpecifierRange,
7869 bool Virtual, AccessSpecifier Access,
7870 TypeSourceInfo *TInfo,
7871 SourceLocation EllipsisLoc);
7872
7873 BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
7874 const ParsedAttributesView &Attrs, bool Virtual,
7875 AccessSpecifier Access, ParsedType basetype,
7876 SourceLocation BaseLoc,
7877 SourceLocation EllipsisLoc);
7878
7881 void ActOnBaseSpecifiers(Decl *ClassDecl,
7883
7886 CXXBasePaths &Paths);
7887
7888 // FIXME: I don't like this name.
7889 void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
7890
7892 SourceLocation Loc, SourceRange Range,
7893 CXXCastPath *BasePath = nullptr,
7894 bool IgnoreAccess = false);
7896 unsigned InaccessibleBaseID,
7897 unsigned AmbiguousBaseConvID,
7898 SourceLocation Loc, SourceRange Range,
7899 DeclarationName Name,
7900 CXXCastPath *BasePath,
7901 bool IgnoreAccess = false);
7902
7903 std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
7904
7906 const CXXMethodDecl *Old);
7907
7908 /// CheckOverridingFunctionReturnType - Checks whether the return types are
7909 /// covariant, according to C++ [class.virtual]p5.
7911 const CXXMethodDecl *Old);
7912
7913 /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
7914 /// spec is a subset of base spec.
7916 const CXXMethodDecl *Old);
7917
7918 bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
7919
7920 /// CheckOverrideControl - Check C++11 override control semantics.
7922
7923 /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
7924 /// not used in the declaration of an overriding method.
7925 void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent);
7926
7927 /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
7928 /// overrides a virtual member function marked 'final', according to
7929 /// C++11 [class.virtual]p4.
7931 const CXXMethodDecl *Old);
7932
7933
7934 //===--------------------------------------------------------------------===//
7935 // C++ Access Control
7936 //
7937
7944
7945 bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
7946 NamedDecl *PrevMemberDecl,
7947 AccessSpecifier LexicalAS);
7948
7950 DeclAccessPair FoundDecl);
7952 DeclAccessPair FoundDecl);
7954 SourceRange PlacementRange,
7955 CXXRecordDecl *NamingClass,
7956 DeclAccessPair FoundDecl,
7957 bool Diagnose = true);
7960 DeclAccessPair FoundDecl,
7961 const InitializedEntity &Entity,
7962 bool IsCopyBindingRefToTemp = false);
7965 DeclAccessPair FoundDecl,
7966 const InitializedEntity &Entity,
7967 const PartialDiagnostic &PDiag);
7969 CXXDestructorDecl *Dtor,
7970 const PartialDiagnostic &PDiag,
7971 QualType objectType = QualType());
7974 CXXRecordDecl *NamingClass,
7975 DeclAccessPair Found);
7978 CXXRecordDecl *DecomposedClass,
7979 DeclAccessPair Field);
7981 const SourceRange &,
7982 DeclAccessPair FoundDecl);
7984 Expr *ObjectExpr,
7985 Expr *ArgExpr,
7986 DeclAccessPair FoundDecl);
7988 ArrayRef<Expr *> ArgExprs,
7989 DeclAccessPair FoundDecl);
7991 DeclAccessPair FoundDecl);
7993 QualType Base, QualType Derived,
7994 const CXXBasePath &Path,
7995 unsigned DiagID,
7996 bool ForceCheck = false,
7997 bool ForceUnprivileged = false);
7998 void CheckLookupAccess(const LookupResult &R);
7999 bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass,
8000 QualType BaseType);
8002 DeclAccessPair Found, QualType ObjectType,
8003 SourceLocation Loc,
8004 const PartialDiagnostic &Diag);
8006 DeclAccessPair Found,
8007 QualType ObjectType) {
8008 return isMemberAccessibleForDeletion(NamingClass, Found, ObjectType,
8009 SourceLocation(), PDiag());
8010 }
8011
8013 const MultiLevelTemplateArgumentList &TemplateArgs);
8014 void PerformDependentDiagnostics(const DeclContext *Pattern,
8015 const MultiLevelTemplateArgumentList &TemplateArgs);
8016
8018
8019 /// When true, access checking violations are treated as SFINAE
8020 /// failures rather than hard errors.
8022
8033
8036 TypeDiagnoser &Diagnoser);
8037 template <typename... Ts>
8038 bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
8039 const Ts &...Args) {
8040 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
8041 return RequireNonAbstractType(Loc, T, Diagnoser);
8042 }
8043
8044 void DiagnoseAbstractType(const CXXRecordDecl *RD);
8045
8046 //===--------------------------------------------------------------------===//
8047 // C++ Overloaded Operators [C++ 13.5]
8048 //
8049
8051
8053
8054 //===--------------------------------------------------------------------===//
8055 // C++ Templates [C++ 14]
8056 //
8058 bool AllowFunctionTemplates = true,
8059 bool AllowDependent = true);
8061 bool AllowFunctionTemplates = true,
8062 bool AllowDependent = true,
8063 bool AllowNonTemplateFunctions = false);
8064 /// Try to interpret the lookup result D as a template-name.
8065 ///
8066 /// \param D A declaration found by name lookup.
8067 /// \param AllowFunctionTemplates Whether function templates should be
8068 /// considered valid results.
8069 /// \param AllowDependent Whether unresolved using declarations (that might
8070 /// name templates) should be considered valid results.
8072 bool AllowFunctionTemplates = true,
8073 bool AllowDependent = true);
8074
8076 /// Whether and why a template name is required in this lookup.
8078 public:
8079 /// Template name is required if TemplateKWLoc is valid.
8081 : TemplateKW(TemplateKWLoc) {}
8082 /// Template name is unconditionally required.
8084
8086 return TemplateKW.value_or(SourceLocation());
8087 }
8089 bool isRequired() const { return TemplateKW != SourceLocation(); }
8090 explicit operator bool() const { return isRequired(); }
8091
8092 private:
8093 std::optional<SourceLocation> TemplateKW;
8094 };
8095
8097 /// This is not assumed to be a template name.
8098 None,
8099 /// This is assumed to be a template name because lookup found nothing.
8101 /// This is assumed to be a template name because lookup found one or more
8102 /// functions (but no function templates).
8104 };
8105 bool LookupTemplateName(
8106 LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType,
8107 bool EnteringContext, bool &MemberOfUnknownSpecialization,
8108 RequiredTemplateKind RequiredTemplate = SourceLocation(),
8109 AssumedTemplateKind *ATK = nullptr, bool AllowTypoCorrection = true);
8110
8112 CXXScopeSpec &SS,
8113 bool hasTemplateKeyword,
8114 const UnqualifiedId &Name,
8115 ParsedType ObjectType,
8116 bool EnteringContext,
8117 TemplateTy &Template,
8118 bool &MemberOfUnknownSpecialization,
8119 bool Disambiguation = false);
8120
8121 /// Try to resolve an undeclared template name as a type template.
8122 ///
8123 /// Sets II to the identifier corresponding to the template name, and updates
8124 /// Name to a corresponding (typo-corrected) type template name and TNK to
8125 /// the corresponding kind, if possible.
8127 TemplateNameKind &TNK,
8128 SourceLocation NameLoc,
8129 IdentifierInfo *&II);
8130
8132 SourceLocation NameLoc,
8133 bool Diagnose = true);
8134
8135 /// Determine whether a particular identifier might be the name in a C++1z
8136 /// deduction-guide declaration.
8137 bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name,
8138 SourceLocation NameLoc, CXXScopeSpec &SS,
8139 ParsedTemplateTy *Template = nullptr);
8140
8142 SourceLocation IILoc,
8143 Scope *S,
8144 const CXXScopeSpec *SS,
8145 TemplateTy &SuggestedTemplate,
8146 TemplateNameKind &SuggestedKind);
8147
8148 bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
8149 NamedDecl *Instantiation,
8150 bool InstantiatedFromMember,
8151 const NamedDecl *Pattern,
8152 const NamedDecl *PatternDef,
8154 bool Complain = true);
8155
8158
8159 NamedDecl *ActOnTypeParameter(Scope *S, bool Typename,
8160 SourceLocation EllipsisLoc,
8161 SourceLocation KeyLoc,
8162 IdentifierInfo *ParamName,
8163 SourceLocation ParamNameLoc,
8164 unsigned Depth, unsigned Position,
8165 SourceLocation EqualLoc,
8166 ParsedType DefaultArg, bool HasTypeConstraint);
8167
8169
8170 bool ActOnTypeConstraint(const CXXScopeSpec &SS,
8172 TemplateTypeParmDecl *ConstrainedParameter,
8173 SourceLocation EllipsisLoc);
8174 bool BuildTypeConstraint(const CXXScopeSpec &SS,
8176 TemplateTypeParmDecl *ConstrainedParameter,
8177 SourceLocation EllipsisLoc,
8178 bool AllowUnexpandedPack);
8179
8181 DeclarationNameInfo NameInfo,
8182 ConceptDecl *NamedConcept,
8183 const TemplateArgumentListInfo *TemplateArgs,
8184 TemplateTypeParmDecl *ConstrainedParameter,
8185 SourceLocation EllipsisLoc);
8186
8188 NonTypeTemplateParmDecl *NewConstrainedParm,
8189 NonTypeTemplateParmDecl *OrigConstrainedParm,
8190 SourceLocation EllipsisLoc);
8191
8193
8195 SourceLocation Loc);
8197
8199 unsigned Depth,
8200 unsigned Position,
8201 SourceLocation EqualLoc,
8202 Expr *DefaultArg);
8204 SourceLocation TmpLoc,
8205 TemplateParameterList *Params,
8206 SourceLocation EllipsisLoc,
8207 IdentifierInfo *ParamName,
8208 SourceLocation ParamNameLoc,
8209 unsigned Depth,
8210 unsigned Position,
8211 SourceLocation EqualLoc,
8212 ParsedTemplateArgument DefaultArg);
8213
8215 ActOnTemplateParameterList(unsigned Depth,
8216 SourceLocation ExportLoc,
8217 SourceLocation TemplateLoc,
8218 SourceLocation LAngleLoc,
8219 ArrayRef<NamedDecl *> Params,
8220 SourceLocation RAngleLoc,
8221 Expr *RequiresClause);
8222
8223 /// The context in which we are checking a template parameter list.
8234
8236 TemplateParameterList *OldParams,
8238 SkipBodyInfo *SkipBody = nullptr);
8240 SourceLocation DeclStartLoc, SourceLocation DeclLoc,
8241 const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
8243 bool IsFriend, bool &IsMemberSpecialization, bool &Invalid,
8244 bool SuppressDiagnostic = false);
8245
8247 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
8248 CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
8249 const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
8250 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
8251 SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists,
8252 TemplateParameterList **OuterTemplateParamLists,
8253 SkipBodyInfo *SkipBody = nullptr);
8254
8256 QualType NTTPType,
8257 SourceLocation Loc);
8258
8259 /// Get a template argument mapping the given template parameter to itself,
8260 /// e.g. for X in \c template<int X>, this would return an expression template
8261 /// argument referencing X.
8263 SourceLocation Location);
8264
8267
8269
8271
8273 SourceLocation TemplateLoc,
8274 TemplateArgumentListInfo &TemplateArgs);
8275
8278 TemplateTy Template, IdentifierInfo *TemplateII,
8279 SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
8280 ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc,
8281 bool IsCtorOrDtorName = false, bool IsClassName = false,
8282 ImplicitTypenameContext AllowImplicitTypename =
8284
8285 /// Parsed an elaborated-type-specifier that refers to a template-id,
8286 /// such as \c class T::template apply<U>.
8288 TypeSpecifierType TagSpec,
8289 SourceLocation TagLoc,
8290 CXXScopeSpec &SS,
8291 SourceLocation TemplateKWLoc,
8292 TemplateTy TemplateD,
8293 SourceLocation TemplateLoc,
8294 SourceLocation LAngleLoc,
8295 ASTTemplateArgsPtr TemplateArgsIn,
8296 SourceLocation RAngleLoc);
8297
8299 Scope *S, Declarator &D, TypeSourceInfo *DI,
8300 SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
8302
8303 /// Get the specialization of the given variable template corresponding to
8304 /// the specified argument list, or a null-but-valid result if the arguments
8305 /// are dependent.
8307 SourceLocation TemplateLoc,
8308 SourceLocation TemplateNameLoc,
8309 const TemplateArgumentListInfo &TemplateArgs);
8310
8311 /// Form a reference to the specialization of the given variable template
8312 /// corresponding to the specified argument list, or a null-but-valid result
8313 /// if the arguments are dependent.
8315 const DeclarationNameInfo &NameInfo,
8316 VarTemplateDecl *Template,
8317 SourceLocation TemplateLoc,
8318 const TemplateArgumentListInfo *TemplateArgs);
8319
8322 SourceLocation TemplateKWLoc,
8323 const DeclarationNameInfo &ConceptNameInfo,
8324 NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
8325 const TemplateArgumentListInfo *TemplateArgs);
8326
8328
8330 SourceLocation TemplateKWLoc,
8331 LookupResult &R,
8332 bool RequiresADL,
8333 const TemplateArgumentListInfo *TemplateArgs);
8334
8336 SourceLocation TemplateKWLoc,
8337 const DeclarationNameInfo &NameInfo,
8338 const TemplateArgumentListInfo *TemplateArgs);
8339
8341 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
8342 const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext,
8343 TemplateTy &Template, bool AllowInjectedClassName = false);
8344
8346 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
8347 SourceLocation ModulePrivateLoc, CXXScopeSpec &SS,
8349 MultiTemplateParamsArg TemplateParameterLists,
8350 SkipBodyInfo *SkipBody = nullptr);
8351
8353 TemplateDecl *PrimaryTemplate,
8354 unsigned NumExplicitArgs,
8360
8362 MultiTemplateParamsArg TemplateParameterLists,
8363 Declarator &D);
8364
8365 bool
8368 NamedDecl *PrevDecl,
8370 SourceLocation PrevPtOfInstantiation,
8371 bool &SuppressNew);
8372
8374 const TemplateArgumentListInfo &ExplicitTemplateArgs,
8376
8378 FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
8379 LookupResult &Previous, bool QualifiedFriend = false);
8382
8384 Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
8385 unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS,
8386 TemplateTy Template, SourceLocation TemplateNameLoc,
8387 SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
8388 SourceLocation RAngleLoc, const ParsedAttributesView &Attr);
8389
8391 SourceLocation TemplateLoc,
8392 unsigned TagSpec, SourceLocation KWLoc,
8393 CXXScopeSpec &SS, IdentifierInfo *Name,
8394 SourceLocation NameLoc,
8395 const ParsedAttributesView &Attr);
8396
8398 SourceLocation ExternLoc,
8399 SourceLocation TemplateLoc,
8400 Declarator &D);
8401
8403 TemplateDecl *Template, SourceLocation TemplateLoc,
8404 SourceLocation RAngleLoc, Decl *Param,
8405 ArrayRef<TemplateArgument> SugaredConverted,
8406 ArrayRef<TemplateArgument> CanonicalConverted, bool &HasDefaultArg);
8407
8408 /// Specifies the context in which a particular template
8409 /// argument is being checked.
8411 /// The template argument was specified in the code or was
8412 /// instantiated with some deduced template arguments.
8414
8415 /// The template argument was deduced via template argument
8416 /// deduction.
8418
8419 /// The template argument was deduced from an array bound
8420 /// via template argument deduction.
8423
8424 bool
8426 NamedDecl *Template, SourceLocation TemplateLoc,
8427 SourceLocation RAngleLoc, unsigned ArgumentPackIndex,
8428 SmallVectorImpl<TemplateArgument> &SugaredConverted,
8429 SmallVectorImpl<TemplateArgument> &CanonicalConverted,
8431
8432 /// Check that the given template arguments can be provided to
8433 /// the given template, converting the arguments along the way.
8434 ///
8435 /// \param Template The template to which the template arguments are being
8436 /// provided.
8437 ///
8438 /// \param TemplateLoc The location of the template name in the source.
8439 ///
8440 /// \param TemplateArgs The list of template arguments. If the template is
8441 /// a template template parameter, this function may extend the set of
8442 /// template arguments to also include substituted, defaulted template
8443 /// arguments.
8444 ///
8445 /// \param PartialTemplateArgs True if the list of template arguments is
8446 /// intentionally partial, e.g., because we're checking just the initial
8447 /// set of template arguments.
8448 ///
8449 /// \param Converted Will receive the converted, canonicalized template
8450 /// arguments.
8451 ///
8452 /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
8453 /// contain the converted forms of the template arguments as written.
8454 /// Otherwise, \p TemplateArgs will not be modified.
8455 ///
8456 /// \param ConstraintsNotSatisfied If provided, and an error occurred, will
8457 /// receive true if the cause for the error is the associated constraints of
8458 /// the template not being satisfied by the template arguments.
8459 ///
8460 /// \returns true if an error occurred, false otherwise.
8462 TemplateDecl *Template, SourceLocation TemplateLoc,
8463 TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs,
8464 SmallVectorImpl<TemplateArgument> &SugaredConverted,
8465 SmallVectorImpl<TemplateArgument> &CanonicalConverted,
8466 bool UpdateArgsWithConversions = true,
8467 bool *ConstraintsNotSatisfied = nullptr);
8468
8471 SmallVectorImpl<TemplateArgument> &SugaredConverted,
8472 SmallVectorImpl<TemplateArgument> &CanonicalConverted);
8473
8476 QualType InstantiatedParamType, Expr *Arg,
8477 TemplateArgument &SugaredConverted,
8478 TemplateArgument &CanonicalConverted,
8481 TemplateParameterList *Params,
8482 TemplateArgumentLoc &Arg);
8483
8486 QualType ParamType,
8487 SourceLocation Loc);
8490 SourceLocation Loc);
8491
8492 /// Enumeration describing how template parameter lists are compared
8493 /// for equality.
8495 /// We are matching the template parameter lists of two templates
8496 /// that might be redeclarations.
8497 ///
8498 /// \code
8499 /// template<typename T> struct X;
8500 /// template<typename T> struct X;
8501 /// \endcode
8503
8504 /// We are matching the template parameter lists of two template
8505 /// template parameters as part of matching the template parameter lists
8506 /// of two templates that might be redeclarations.
8507 ///
8508 /// \code
8509 /// template<template<int I> class TT> struct X;
8510 /// template<template<int Value> class Other> struct X;
8511 /// \endcode
8513
8514 /// We are matching the template parameter lists of a template
8515 /// template argument against the template parameter lists of a template
8516 /// template parameter.
8517 ///
8518 /// \code
8519 /// template<template<int Value> class Metafun> struct X;
8520 /// template<int Value> struct integer_c;
8521 /// X<integer_c> xic;
8522 /// \endcode
8524
8525 /// We are determining whether the template-parameters are equivalent
8526 /// according to C++ [temp.over.link]/6. This comparison does not consider
8527 /// constraints.
8528 ///
8529 /// \code
8530 /// template<C1 T> void f(T);
8531 /// template<C2 T> void f(T);
8532 /// \endcode
8534 };
8535
8537 const NamedDecl *NewInstFrom, TemplateParameterList *New,
8538 const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain,
8540 SourceLocation TemplateArgLoc = SourceLocation());
8541
8543 TemplateParameterList *New, TemplateParameterList *Old, bool Complain,
8545 SourceLocation TemplateArgLoc = SourceLocation()) {
8546 return TemplateParameterListsAreEqual(nullptr, New, nullptr, Old, Complain,
8547 Kind, TemplateArgLoc);
8548 }
8549
8550 bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
8551
8552 /// Called when the parser has parsed a C++ typename
8553 /// specifier, e.g., "typename T::type".
8554 ///
8555 /// \param S The scope in which this typename type occurs.
8556 /// \param TypenameLoc the location of the 'typename' keyword
8557 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
8558 /// \param II the identifier we're retrieving (e.g., 'type' in the example).
8559 /// \param IdLoc the location of the identifier.
8560 /// \param IsImplicitTypename context where T::type refers to a type.
8562 Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS,
8563 const IdentifierInfo &II, SourceLocation IdLoc,
8565
8566 /// Called when the parser has parsed a C++ typename
8567 /// specifier that ends in a template-id, e.g.,
8568 /// "typename MetaFun::template apply<T1, T2>".
8569 ///
8570 /// \param S The scope in which this typename type occurs.
8571 /// \param TypenameLoc the location of the 'typename' keyword
8572 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
8573 /// \param TemplateLoc the location of the 'template' keyword, if any.
8574 /// \param TemplateName The template name.
8575 /// \param TemplateII The identifier used to name the template.
8576 /// \param TemplateIILoc The location of the template name.
8577 /// \param LAngleLoc The location of the opening angle bracket ('<').
8578 /// \param TemplateArgs The template arguments.
8579 /// \param RAngleLoc The location of the closing angle bracket ('>').
8581 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
8582 const CXXScopeSpec &SS,
8583 SourceLocation TemplateLoc,
8585 IdentifierInfo *TemplateII,
8586 SourceLocation TemplateIILoc,
8587 SourceLocation LAngleLoc,
8588 ASTTemplateArgsPtr TemplateArgs,
8589 SourceLocation RAngleLoc);
8590
8591 QualType CheckTypenameType(ElaboratedTypeKeyword Keyword,
8592 SourceLocation KeywordLoc,
8593 NestedNameSpecifierLoc QualifierLoc,
8594 const IdentifierInfo &II,
8595 SourceLocation IILoc,
8596 TypeSourceInfo **TSI,
8597 bool DeducedTSTContext);
8598
8599 QualType CheckTypenameType(ElaboratedTypeKeyword Keyword,
8600 SourceLocation KeywordLoc,
8601 NestedNameSpecifierLoc QualifierLoc,
8602 const IdentifierInfo &II,
8603 SourceLocation IILoc,
8604 bool DeducedTSTContext = true);
8605
8606
8608 SourceLocation Loc,
8609 DeclarationName Name);
8611
8614 TemplateParameterList *Params);
8615
8616 std::string
8618 const TemplateArgumentList &Args);
8619
8620 std::string
8622 const TemplateArgument *Args,
8623 unsigned NumArgs);
8624
8625 //===--------------------------------------------------------------------===//
8626 // C++ Concepts
8627 //===--------------------------------------------------------------------===//
8629 Scope *S, MultiTemplateParamsArg TemplateParameterLists,
8630 IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr);
8631
8633 bool &AddToScope);
8634
8637 ArrayRef<ParmVarDecl *> LocalParameters,
8638 Scope *BodyScope);
8642 SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc,
8643 IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId);
8645 SourceLocation NoexceptLoc);
8648 Expr *E, SourceLocation NoexceptLoc, CXXScopeSpec &SS,
8649 TemplateIdAnnotation *TypeConstraint, unsigned Depth);
8653 Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc,
8658 bool IsSatisfied, SourceLocation NoexceptLoc,
8666 BuildNestedRequirement(StringRef InvalidConstraintEntity,
8667 const ASTConstraintSatisfaction &Satisfaction);
8670 ArrayRef<ParmVarDecl *> LocalParameters,
8672 SourceLocation ClosingBraceLoc);
8673
8674 //===--------------------------------------------------------------------===//
8675 // C++ Variadic Templates (C++0x [temp.variadic])
8676 //===--------------------------------------------------------------------===//
8677
8678 /// Determine whether an unexpanded parameter pack might be permitted in this
8679 /// location. Useful for error recovery.
8681
8682 /// The context in which an unexpanded parameter pack is
8683 /// being diagnosed.
8684 ///
8685 /// Note that the values of this enumeration line up with the first
8686 /// argument to the \c err_unexpanded_parameter_pack diagnostic.
8688 /// An arbitrary expression.
8690
8691 /// The base type of a class type.
8693
8694 /// The type of an arbitrary declaration.
8696
8697 /// The type of a data member.
8699
8700 /// The size of a bit-field.
8702
8703 /// The expression in a static assertion.
8705
8706 /// The fixed underlying type of an enumeration.
8708
8709 /// The enumerator value.
8711
8712 /// A using declaration.
8714
8715 /// A friend declaration.
8717
8718 /// A declaration qualifier.
8720
8721 /// An initializer.
8723
8724 /// A default argument.
8726
8727 /// The type of a non-type template parameter.
8729
8730 /// The type of an exception.
8732
8733 /// Partial specialization.
8735
8736 /// Microsoft __if_exists.
8738
8739 /// Microsoft __if_not_exists.
8741
8742 /// Lambda expression.
8744
8745 /// Block expression.
8747
8748 /// A type constraint.
8750
8751 // A requirement in a requires-expression.
8753
8754 // A requires-clause.
8756 };
8757
8758 /// Diagnose unexpanded parameter packs.
8759 ///
8760 /// \param Loc The location at which we should emit the diagnostic.
8761 ///
8762 /// \param UPPC The context in which we are diagnosing unexpanded
8763 /// parameter packs.
8764 ///
8765 /// \param Unexpanded the set of unexpanded parameter packs.
8766 ///
8767 /// \returns true if an error occurred, false otherwise.
8771
8772 /// If the given type contains an unexpanded parameter pack,
8773 /// diagnose the error.
8774 ///
8775 /// \param Loc The source location where a diagnostc should be emitted.
8776 ///
8777 /// \param T The type that is being checked for unexpanded parameter
8778 /// packs.
8779 ///
8780 /// \returns true if an error occurred, false otherwise.
8783
8784 /// If the given expression contains an unexpanded parameter
8785 /// pack, diagnose the error.
8786 ///
8787 /// \param E The expression that is being checked for unexpanded
8788 /// parameter packs.
8789 ///
8790 /// \returns true if an error occurred, false otherwise.
8793
8794 /// If the given requirees-expression contains an unexpanded reference to one
8795 /// of its own parameter packs, diagnose the error.
8796 ///
8797 /// \param RE The requiress-expression that is being checked for unexpanded
8798 /// parameter packs.
8799 ///
8800 /// \returns true if an error occurred, false otherwise.
8802
8803 /// If the given nested-name-specifier contains an unexpanded
8804 /// parameter pack, diagnose the error.
8805 ///
8806 /// \param SS The nested-name-specifier that is being checked for
8807 /// unexpanded parameter packs.
8808 ///
8809 /// \returns true if an error occurred, false otherwise.
8812
8813 /// If the given name contains an unexpanded parameter pack,
8814 /// diagnose the error.
8815 ///
8816 /// \param NameInfo The name (with source location information) that
8817 /// is being checked for unexpanded parameter packs.
8818 ///
8819 /// \returns true if an error occurred, false otherwise.
8822
8823 /// If the given template name contains an unexpanded parameter pack,
8824 /// diagnose the error.
8825 ///
8826 /// \param Loc The location of the template name.
8827 ///
8828 /// \param Template The template name that is being checked for unexpanded
8829 /// parameter packs.
8830 ///
8831 /// \returns true if an error occurred, false otherwise.
8833 TemplateName Template,
8835
8836 /// If the given template argument contains an unexpanded parameter
8837 /// pack, diagnose the error.
8838 ///
8839 /// \param Arg The template argument that is being checked for unexpanded
8840 /// parameter packs.
8841 ///
8842 /// \returns true if an error occurred, false otherwise.
8845
8846 /// Collect the set of unexpanded parameter packs within the given
8847 /// template argument.
8848 ///
8849 /// \param Arg The template argument that will be traversed to find
8850 /// unexpanded parameter packs.
8853
8854 /// Collect the set of unexpanded parameter packs within the given
8855 /// template argument.
8856 ///
8857 /// \param Arg The template argument that will be traversed to find
8858 /// unexpanded parameter packs.
8861
8862 /// Collect the set of unexpanded parameter packs within the given
8863 /// type.
8864 ///
8865 /// \param T The type that will be traversed to find
8866 /// unexpanded parameter packs.
8869
8870 /// Collect the set of unexpanded parameter packs within the given
8871 /// type.
8872 ///
8873 /// \param TL The type that will be traversed to find
8874 /// unexpanded parameter packs.
8877
8878 /// Collect the set of unexpanded parameter packs within the given
8879 /// nested-name-specifier.
8880 ///
8881 /// \param NNS The nested-name-specifier that will be traversed to find
8882 /// unexpanded parameter packs.
8885
8886 /// Collect the set of unexpanded parameter packs within the given
8887 /// name.
8888 ///
8889 /// \param NameInfo The name that will be traversed to find
8890 /// unexpanded parameter packs.
8893
8894 /// Invoked when parsing a template argument followed by an
8895 /// ellipsis, which creates a pack expansion.
8896 ///
8897 /// \param Arg The template argument preceding the ellipsis, which
8898 /// may already be invalid.
8899 ///
8900 /// \param EllipsisLoc The location of the ellipsis.
8902 SourceLocation EllipsisLoc);
8903
8904 /// Invoked when parsing a type followed by an ellipsis, which
8905 /// creates a pack expansion.
8906 ///
8907 /// \param Type The type preceding the ellipsis, which will become
8908 /// the pattern of the pack expansion.
8909 ///
8910 /// \param EllipsisLoc The location of the ellipsis.
8912
8913 /// Construct a pack expansion type from the pattern of the pack
8914 /// expansion.
8916 SourceLocation EllipsisLoc,
8917 std::optional<unsigned> NumExpansions);
8918
8919 /// Construct a pack expansion type from the pattern of the pack
8920 /// expansion.
8921 QualType CheckPackExpansion(QualType Pattern, SourceRange PatternRange,
8922 SourceLocation EllipsisLoc,
8923 std::optional<unsigned> NumExpansions);
8924
8925 /// Invoked when parsing an expression followed by an ellipsis, which
8926 /// creates a pack expansion.
8927 ///
8928 /// \param Pattern The expression preceding the ellipsis, which will become
8929 /// the pattern of the pack expansion.
8930 ///
8931 /// \param EllipsisLoc The location of the ellipsis.
8932 ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
8933
8934 /// Invoked when parsing an expression followed by an ellipsis, which
8935 /// creates a pack expansion.
8936 ///
8937 /// \param Pattern The expression preceding the ellipsis, which will become
8938 /// the pattern of the pack expansion.
8939 ///
8940 /// \param EllipsisLoc The location of the ellipsis.
8941 ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
8942 std::optional<unsigned> NumExpansions);
8943
8944 /// Determine whether we could expand a pack expansion with the
8945 /// given set of parameter packs into separate arguments by repeatedly
8946 /// transforming the pattern.
8947 ///
8948 /// \param EllipsisLoc The location of the ellipsis that identifies the
8949 /// pack expansion.
8950 ///
8951 /// \param PatternRange The source range that covers the entire pattern of
8952 /// the pack expansion.
8953 ///
8954 /// \param Unexpanded The set of unexpanded parameter packs within the
8955 /// pattern.
8956 ///
8957 /// \param ShouldExpand Will be set to \c true if the transformer should
8958 /// expand the corresponding pack expansions into separate arguments. When
8959 /// set, \c NumExpansions must also be set.
8960 ///
8961 /// \param RetainExpansion Whether the caller should add an unexpanded
8962 /// pack expansion after all of the expanded arguments. This is used
8963 /// when extending explicitly-specified template argument packs per
8964 /// C++0x [temp.arg.explicit]p9.
8965 ///
8966 /// \param NumExpansions The number of separate arguments that will be in
8967 /// the expanded form of the corresponding pack expansion. This is both an
8968 /// input and an output parameter, which can be set by the caller if the
8969 /// number of expansions is known a priori (e.g., due to a prior substitution)
8970 /// and will be set by the callee when the number of expansions is known.
8971 /// The callee must set this value when \c ShouldExpand is \c true; it may
8972 /// set this value in other cases.
8973 ///
8974 /// \returns true if an error occurred (e.g., because the parameter packs
8975 /// are to be instantiated with arguments of different lengths), false
8976 /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
8977 /// must be set.
8979 SourceLocation EllipsisLoc, SourceRange PatternRange,
8981 const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand,
8982 bool &RetainExpansion, std::optional<unsigned> &NumExpansions);
8983
8984 /// Determine the number of arguments in the given pack expansion
8985 /// type.
8986 ///
8987 /// This routine assumes that the number of arguments in the expansion is
8988 /// consistent across all of the unexpanded parameter packs in its pattern.
8989 ///
8990 /// Returns an empty Optional if the type can't be expanded.
8991 std::optional<unsigned> getNumArgumentsInExpansion(
8992 QualType T, const MultiLevelTemplateArgumentList &TemplateArgs);
8993
8994 /// Determine whether the given declarator contains any unexpanded
8995 /// parameter packs.
8996 ///
8997 /// This routine is used by the parser to disambiguate function declarators
8998 /// with an ellipsis prior to the ')', e.g.,
8999 ///
9000 /// \code
9001 /// void f(T...);
9002 /// \endcode
9003 ///
9004 /// To determine whether we have an (unnamed) function parameter pack or
9005 /// a variadic function.
9006 ///
9007 /// \returns true if the declarator contains any unexpanded parameter packs,
9008 /// false otherwise.
9010
9011 /// Returns the pattern of the pack expansion for a template argument.
9012 ///
9013 /// \param OrigLoc The template argument to expand.
9014 ///
9015 /// \param Ellipsis Will be set to the location of the ellipsis.
9016 ///
9017 /// \param NumExpansions Will be set to the number of expansions that will
9018 /// be generated from this pack expansion, if known a priori.
9020 TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis,
9021 std::optional<unsigned> &NumExpansions) const;
9022
9023 /// Given a template argument that contains an unexpanded parameter pack, but
9024 /// which has already been substituted, attempt to determine the number of
9025 /// elements that will be produced once this argument is fully-expanded.
9026 ///
9027 /// This is intended for use when transforming 'sizeof...(Arg)' in order to
9028 /// avoid actually expanding the pack where possible.
9029 std::optional<unsigned> getFullyPackExpandedSize(TemplateArgument Arg);
9030
9031 //===--------------------------------------------------------------------===//
9032 // C++ Template Argument Deduction (C++ [temp.deduct])
9033 //===--------------------------------------------------------------------===//
9034
9035 /// Adjust the type \p ArgFunctionType to match the calling convention,
9036 /// noreturn, and optionally the exception specification of \p FunctionType.
9037 /// Deduction often wants to ignore these properties when matching function
9038 /// types.
9040 bool AdjustExceptionSpec = false);
9041
9042 /// Describes the result of template argument deduction.
9043 ///
9044 /// The TemplateDeductionResult enumeration describes the result of
9045 /// template argument deduction, as returned from
9046 /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
9047 /// structure provides additional information about the results of
9048 /// template argument deduction, e.g., the deduced template argument
9049 /// list (if successful) or the specific template parameters or
9050 /// deduced arguments that were involved in the failure.
9052 /// Template argument deduction was successful.
9054 /// The declaration was invalid; do nothing.
9056 /// Template argument deduction exceeded the maximum template
9057 /// instantiation depth (which has already been diagnosed).
9059 /// Template argument deduction did not deduce a value
9060 /// for every template parameter.
9062 /// Template argument deduction did not deduce a value for every
9063 /// expansion of an expanded template parameter pack.
9065 /// Template argument deduction produced inconsistent
9066 /// deduced values for the given template parameter.
9068 /// Template argument deduction failed due to inconsistent
9069 /// cv-qualifiers on a template parameter type that would
9070 /// otherwise be deduced, e.g., we tried to deduce T in "const T"
9071 /// but were given a non-const "X".
9073 /// Substitution of the deduced template argument values
9074 /// resulted in an error.
9076 /// After substituting deduced template arguments, a dependent
9077 /// parameter type did not match the corresponding argument.
9079 /// After substituting deduced template arguments, an element of
9080 /// a dependent parameter type did not match the corresponding element
9081 /// of the corresponding argument (when deducing from an initializer list).
9083 /// A non-depnedent component of the parameter did not match the
9084 /// corresponding component of the argument.
9086 /// When performing template argument deduction for a function
9087 /// template, there were too many call arguments.
9089 /// When performing template argument deduction for a function
9090 /// template, there were too few call arguments.
9092 /// The explicitly-specified template arguments were not valid
9093 /// template arguments for the given template.
9095 /// Checking non-dependent argument conversions failed.
9097 /// The deduced arguments did not satisfy the constraints associated
9098 /// with the template.
9100 /// Deduction failed; that's all we know.
9102 /// CUDA Target attributes do not match.
9104 /// Some error which was already diagnosed.
9107
9110 const TemplateArgumentList &TemplateArgs,
9112
9115 const TemplateArgumentList &TemplateArgs,
9117
9120 TemplateArgumentListInfo &ExplicitTemplateArgs,
9124
9125 /// brief A function argument from which we performed template argument
9126 // deduction for a call.
9139
9143 unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
9145 SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
9146 bool PartialOverloading = false,
9147 llvm::function_ref<bool()> CheckNonDependent = []{ return false; });
9148
9151 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
9153 bool PartialOverloading, bool AggregateDeductionCandidate,
9154 llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
9155
9158 TemplateArgumentListInfo *ExplicitTemplateArgs,
9159 QualType ArgFunctionType,
9162 bool IsAddressOfFunction = false);
9163
9166 QualType ToType,
9169
9172 TemplateArgumentListInfo *ExplicitTemplateArgs,
9175 bool IsAddressOfFunction = false);
9176
9177 /// Substitute Replacement for \p auto in \p TypeWithAuto
9178 QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
9179 /// Substitute Replacement for auto in TypeWithAuto
9181 QualType Replacement);
9182
9183 // Substitute auto in TypeWithAuto for a Dependent auto type
9185
9186 // Substitute auto in TypeWithAuto for a Dependent auto type
9189
9190 /// Completely replace the \c auto in \p TypeWithAuto by
9191 /// \p Replacement. This does not retain any \c auto type sugar.
9192 QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
9194 QualType Replacement);
9195
9199 bool DependentDeduction = false,
9200 bool IgnoreConstraints = false,
9201 TemplateSpecCandidateSet *FailedTSC = nullptr);
9202 void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
9204 bool Diagnose = true);
9205
9207 SourceLocation Loc);
9208
9209 /// Declare implicit deduction guides for a class template if we've
9210 /// not already done so.
9212 SourceLocation Loc);
9214 TemplateDecl *Template, MutableArrayRef<QualType> ParamTypes,
9215 SourceLocation Loc);
9216 llvm::DenseMap<unsigned, CXXDeductionGuideDecl *>
9218
9220 TypeSourceInfo *TInfo, const InitializedEntity &Entity,
9221 const InitializationKind &Kind, MultiExprArg Init,
9222 ParenListExpr *PL = nullptr);
9223
9226 SourceRange Range, bool DirectInit,
9227 Expr *Init);
9228
9230
9232 SourceLocation ReturnLoc, Expr *RetExpr,
9233 const AutoType *AT);
9234
9237 TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
9238 unsigned NumCallArguments2, bool Reversed = false);
9241 TemplateSpecCandidateSet &FailedCandidates,
9242 SourceLocation Loc,
9243 const PartialDiagnostic &NoneDiag,
9244 const PartialDiagnostic &AmbigDiag,
9245 const PartialDiagnostic &CandidateDiag,
9246 bool Complain = true, QualType TargetType = QualType());
9247
9252 SourceLocation Loc);
9253
9256
9260
9263
9266
9267 void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
9268 unsigned Depth, llvm::SmallBitVector &Used);
9269
9270 void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
9271 bool OnlyDeduced,
9272 unsigned Depth,
9273 llvm::SmallBitVector &Used);
9276 llvm::SmallBitVector &Deduced) {
9278 }
9281 llvm::SmallBitVector &Deduced);
9282
9283 //===--------------------------------------------------------------------===//
9284 // C++ Template Instantiation
9285 //
9286
9288 getTemplateInstantiationArgs(const NamedDecl *D, bool Final = false,
9289 const TemplateArgumentList *Innermost = nullptr,
9290 bool RelativeToPrimary = false,
9291 const FunctionDecl *Pattern = nullptr,
9292 bool ForConstraintInstantiation = false,
9293 bool SkipForSpecialization = false);
9294
9295 /// A context in which code is being synthesized (where a source location
9296 /// alone is not sufficient to identify the context). This covers template
9297 /// instantiation and various forms of implicitly-generated functions.
9299 /// The kind of template instantiation we are performing
9301 /// We are instantiating a template declaration. The entity is
9302 /// the declaration we're instantiating (e.g., a CXXRecordDecl).
9304
9305 /// We are instantiating a default argument for a template
9306 /// parameter. The Entity is the template parameter whose argument is
9307 /// being instantiated, the Template is the template, and the
9308 /// TemplateArgs/NumTemplateArguments provide the template arguments as
9309 /// specified.
9311
9312 /// We are instantiating a default argument for a function.
9313 /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
9314 /// provides the template arguments as specified.
9316
9317 /// We are substituting explicit template arguments provided for
9318 /// a function template. The entity is a FunctionTemplateDecl.
9320
9321 /// We are substituting template argument determined as part of
9322 /// template argument deduction for either a class template
9323 /// partial specialization or a function template. The
9324 /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
9325 /// a TemplateDecl.
9327
9328 /// We are substituting into a lambda expression.
9330
9331 /// We are substituting prior template arguments into a new
9332 /// template parameter. The template parameter itself is either a
9333 /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
9335
9336 /// We are checking the validity of a default template argument that
9337 /// has been used when naming a template-id.
9339
9340 /// We are computing the exception specification for a defaulted special
9341 /// member function.
9343
9344 /// We are instantiating the exception specification for a function
9345 /// template which was deferred until it was needed.
9347
9348 /// We are instantiating a requirement of a requires expression.
9350
9351 /// We are checking the satisfaction of a nested requirement of a requires
9352 /// expression.
9354
9355 /// We are declaring an implicit special member function.
9357
9358 /// We are declaring an implicit 'operator==' for a defaulted
9359 /// 'operator<=>'.
9361
9362 /// We are defining a synthesized function (such as a defaulted special
9363 /// member).
9365
9366 // We are checking the constraints associated with a constrained entity or
9367 // the constraint expression of a concept. This includes the checks that
9368 // atomic constraints have the type 'bool' and that they can be constant
9369 // evaluated.
9371
9372 // We are substituting template arguments into a constraint expression.
9374
9375 // We are normalizing a constraint expression.
9377
9378 // Instantiating a Requires Expression parameter clause.
9380
9381 // We are substituting into the parameter mapping of an atomic constraint
9382 // during normalization.
9384
9385 /// We are rewriting a comparison operator in terms of an operator<=>.
9387
9388 /// We are initializing a structured binding.
9390
9391 /// We are marking a class as __dllexport.
9393
9394 /// We are building an implied call from __builtin_dump_struct. The
9395 /// arguments are in CallArgs.
9397
9398 /// Added for Template instantiation observation.
9399 /// Memoization means we are _not_ instantiating a template because
9400 /// it is already instantiated (but we entered a context where we
9401 /// would have had to if it was not already instantiated).
9403
9404 /// We are building deduction guides for a class.
9407
9408 /// Was the enclosing context a non-instantiation SFINAE context?
9410
9411 /// The point of instantiation or synthesis within the source code.
9413
9414 /// The entity that is being synthesized.
9416
9417 /// The template (or partial specialization) in which we are
9418 /// performing the instantiation, for substitutions of prior template
9419 /// arguments.
9421
9422 union {
9423 /// The list of template arguments we are substituting, if they
9424 /// are not part of the entity.
9426
9427 /// The list of argument expressions in a synthesized call.
9428 const Expr *const *CallArgs;
9429 };
9430
9431 // FIXME: Wrap this union around more members, or perhaps store the
9432 // kind-specific members in the RAII object owning the context.
9433 union {
9434 /// The number of template arguments in TemplateArgs.
9436
9437 /// The number of expressions in CallArgs.
9438 unsigned NumCallArgs;
9439
9440 /// The special member being declared or defined.
9442 };
9443
9445 assert(Kind != DeclaringSpecialMember);
9446 return {TemplateArgs, NumTemplateArgs};
9447 }
9448
9449 /// The template deduction info object associated with the
9450 /// substitution or checking of explicit or deduced template arguments.
9452
9453 /// The source range that covers the construct that cause
9454 /// the instantiation, e.g., the template-id that causes a class
9455 /// template instantiation.
9457
9463
9464 /// Determines whether this template is an actual instantiation
9465 /// that should be counted toward the maximum instantiation depth.
9466 bool isInstantiationRecord() const;
9467 };
9468
9469 /// List of active code synthesis contexts.
9470 ///
9471 /// This vector is treated as a stack. As synthesis of one entity requires
9472 /// synthesis of another, additional contexts are pushed onto the stack.
9474
9475 /// Specializations whose definitions are currently being instantiated.
9477
9478 /// Non-dependent types used in templates that have already been instantiated
9479 /// by some template instantiation.
9481
9482 /// Extra modules inspected when performing a lookup during a template
9483 /// instantiation. Computed lazily.
9485
9486 /// Cache of additional modules that should be used for name lookup
9487 /// within the current template instantiation. Computed lazily; use
9488 /// getLookupModules() to get a complete set.
9490
9491 /// Get the set of additional modules that should be checked during
9492 /// name lookup. A module and its imports become visible when instanting a
9493 /// template defined within it.
9495
9496 /// Map from the most recent declaration of a namespace to the most
9497 /// recent visible declaration of that namespace.
9498 llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
9499
9500 /// Whether we are in a SFINAE context that is not associated with
9501 /// template instantiation.
9502 ///
9503 /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
9504 /// of a template instantiation or template argument deduction.
9506
9507 /// The number of \p CodeSynthesisContexts that are not template
9508 /// instantiations and, therefore, should not be counted as part of the
9509 /// instantiation depth.
9510 ///
9511 /// When the instantiation depth reaches the user-configurable limit
9512 /// \p LangOptions::InstantiationDepth we will abort instantiation.
9513 // FIXME: Should we have a similar limit for other forms of synthesis?
9515
9516 /// The depth of the context stack at the point when the most recent
9517 /// error or warning was produced.
9518 ///
9519 /// This value is used to suppress printing of redundant context stacks
9520 /// when there are multiple errors or warnings in the same instantiation.
9521 // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
9523
9524 /// The template instantiation callbacks to trace or track
9525 /// instantiations (objects can be chained).
9526 ///
9527 /// This callbacks is used to print, trace or track template
9528 /// instantiations as they are being constructed.
9529 std::vector<std::unique_ptr<TemplateInstantiationCallback>>
9531
9532 /// The current index into pack expansion arguments that will be
9533 /// used for substitution of parameter packs.
9534 ///
9535 /// The pack expansion index will be -1 to indicate that parameter packs
9536 /// should be instantiated as themselves. Otherwise, the index specifies
9537 /// which argument within the parameter pack will be used for substitution.
9539
9540 /// RAII object used to change the argument pack substitution index
9541 /// within a \c Sema object.
9542 ///
9543 /// See \c ArgumentPackSubstitutionIndex for more information.
9545 Sema &Self;
9546 int OldSubstitutionIndex;
9547
9548 public:
9549 ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
9550 : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
9551 Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
9552 }
9553
9555 Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
9556 }
9557 };
9558
9560
9561 /// For each declaration that involved template argument deduction, the
9562 /// set of diagnostics that were suppressed during that template argument
9563 /// deduction.
9564 ///
9565 /// FIXME: Serialize this structure to the AST file.
9566 typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
9569
9570 /// A stack object to be created when performing template
9571 /// instantiation.
9572 ///
9573 /// Construction of an object of type \c InstantiatingTemplate
9574 /// pushes the current instantiation onto the stack of active
9575 /// instantiations. If the size of this stack exceeds the maximum
9576 /// number of recursive template instantiations, construction
9577 /// produces an error and evaluates true.
9578 ///
9579 /// Destruction of this object will pop the named instantiation off
9580 /// the stack.
9582 /// Note that we are instantiating a class template,
9583 /// function template, variable template, alias template,
9584 /// or a member thereof.
9585 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9586 Decl *Entity,
9587 SourceRange InstantiationRange = SourceRange());
9588
9590 /// Note that we are instantiating an exception specification
9591 /// of a function template.
9592 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9594 SourceRange InstantiationRange = SourceRange());
9595
9596 /// Note that we are instantiating a default argument in a
9597 /// template-id.
9598 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9599 TemplateParameter Param, TemplateDecl *Template,
9600 ArrayRef<TemplateArgument> TemplateArgs,
9601 SourceRange InstantiationRange = SourceRange());
9602
9603 /// Note that we are substituting either explicitly-specified or
9604 /// deduced template arguments during function template argument deduction.
9605 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9607 ArrayRef<TemplateArgument> TemplateArgs,
9609 sema::TemplateDeductionInfo &DeductionInfo,
9610 SourceRange InstantiationRange = SourceRange());
9611
9612 /// Note that we are instantiating as part of template
9613 /// argument deduction for a class template declaration.
9614 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9615 TemplateDecl *Template,
9616 ArrayRef<TemplateArgument> TemplateArgs,
9617 sema::TemplateDeductionInfo &DeductionInfo,
9618 SourceRange InstantiationRange = SourceRange());
9619
9620 /// Note that we are instantiating as part of template
9621 /// argument deduction for a class template partial
9622 /// specialization.
9623 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9625 ArrayRef<TemplateArgument> TemplateArgs,
9626 sema::TemplateDeductionInfo &DeductionInfo,
9627 SourceRange InstantiationRange = SourceRange());
9628
9629 /// Note that we are instantiating as part of template
9630 /// argument deduction for a variable template partial
9631 /// specialization.
9632 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9634 ArrayRef<TemplateArgument> TemplateArgs,
9635 sema::TemplateDeductionInfo &DeductionInfo,
9636 SourceRange InstantiationRange = SourceRange());
9637
9638 /// Note that we are instantiating a default argument for a function
9639 /// parameter.
9640 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9641 ParmVarDecl *Param,
9642 ArrayRef<TemplateArgument> TemplateArgs,
9643 SourceRange InstantiationRange = SourceRange());
9644
9645 /// Note that we are substituting prior template arguments into a
9646 /// non-type parameter.
9647 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9648 NamedDecl *Template,
9650 ArrayRef<TemplateArgument> TemplateArgs,
9651 SourceRange InstantiationRange);
9652
9653 /// Note that we are substituting prior template arguments into a
9654 /// template template parameter.
9655 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9656 NamedDecl *Template,
9658 ArrayRef<TemplateArgument> TemplateArgs,
9659 SourceRange InstantiationRange);
9660
9661 /// Note that we are checking the default template argument
9662 /// against the template parameter for a given template-id.
9663 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9664 TemplateDecl *Template,
9665 NamedDecl *Param,
9666 ArrayRef<TemplateArgument> TemplateArgs,
9667 SourceRange InstantiationRange);
9668
9670 /// \brief Note that we are checking the constraints associated with some
9671 /// constrained entity (a concept declaration or a template with associated
9672 /// constraints).
9673 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9674 ConstraintsCheck, NamedDecl *Template,
9675 ArrayRef<TemplateArgument> TemplateArgs,
9676 SourceRange InstantiationRange);
9677
9679 /// \brief Note that we are checking a constraint expression associated
9680 /// with a template declaration or as part of the satisfaction check of a
9681 /// concept.
9682 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9684 sema::TemplateDeductionInfo &DeductionInfo,
9685 SourceRange InstantiationRange);
9686
9688 /// \brief Note that we are normalizing a constraint expression.
9689 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9691 SourceRange InstantiationRange);
9692
9694 /// \brief Note that we are subtituting into the parameter mapping of an
9695 /// atomic constraint during constraint normalization.
9696 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9698 SourceRange InstantiationRange);
9699
9700 /// \brief Note that we are substituting template arguments into a part of
9701 /// a requirement of a requires expression.
9702 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9704 sema::TemplateDeductionInfo &DeductionInfo,
9705 SourceRange InstantiationRange = SourceRange());
9706
9707 /// \brief Note that we are checking the satisfaction of the constraint
9708 /// expression inside of a nested requirement.
9709 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9711 SourceRange InstantiationRange = SourceRange());
9712
9713 /// \brief Note that we are checking a requires clause.
9714 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9715 const RequiresExpr *E,
9716 sema::TemplateDeductionInfo &DeductionInfo,
9717 SourceRange InstantiationRange);
9718
9720 /// \brief Note that we are building deduction guides.
9721 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9723 SourceRange InstantiationRange = SourceRange());
9724
9725 /// Note that we have finished instantiating this template.
9726 void Clear();
9727
9729
9730 /// Determines whether we have exceeded the maximum
9731 /// recursive template instantiations.
9732 bool isInvalid() const { return Invalid; }
9733
9734 /// Determine whether we are already instantiating this
9735 /// specialization in some surrounding active instantiation.
9736 bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
9737
9738 private:
9739 Sema &SemaRef;
9740 bool Invalid;
9741 bool AlreadyInstantiating;
9742 bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
9743 SourceRange InstantiationRange);
9744
9747 SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
9748 Decl *Entity, NamedDecl *Template = nullptr,
9749 ArrayRef<TemplateArgument> TemplateArgs = std::nullopt,
9750 sema::TemplateDeductionInfo *DeductionInfo = nullptr);
9751
9753
9755 operator=(const InstantiatingTemplate&) = delete;
9756 };
9757
9758 void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
9760
9761 /// Determine whether we are currently performing template instantiation.
9764 }
9765
9776
9778
9779 /// Determines whether we are currently in a context where
9780 /// template argument substitution failures are not considered
9781 /// errors.
9782 ///
9783 /// \returns An empty \c Optional if we're not in a SFINAE context.
9784 /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
9785 /// template-deduction context object, which can be used to capture
9786 /// diagnostics that will be suppressed.
9787 std::optional<sema::TemplateDeductionInfo *> isSFINAEContext() const;
9788
9789 /// Determines whether we are currently in a context that
9790 /// is not evaluated as per C++ [expr] p5.
9792 assert(!ExprEvalContexts.empty() &&
9793 "Must be in an expression evaluation context");
9794 return ExprEvalContexts.back().isUnevaluated();
9795 }
9796
9798 assert(!ExprEvalContexts.empty() &&
9799 "Must be in an expression evaluation context");
9800 return ExprEvalContexts.back().isConstantEvaluated();
9801 }
9802
9804 assert(!ExprEvalContexts.empty() &&
9805 "Must be in an expression evaluation context");
9806 return ExprEvalContexts.back().isImmediateFunctionContext();
9807 }
9808
9810 assert(!ExprEvalContexts.empty() &&
9811 "Must be in an expression evaluation context");
9813 return (Ctx.Context ==
9816 }
9817
9818 std::optional<ExpressionEvaluationContextRecord::InitializationContext>
9820 assert(!ExprEvalContexts.empty() &&
9821 "Must be in an expression evaluation context");
9822 for (const auto &Ctx : llvm::reverse(ExprEvalContexts)) {
9824 Ctx.DelayedDefaultInitializationContext)
9825 return Ctx.DelayedDefaultInitializationContext;
9826 if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
9827 Ctx.isUnevaluated())
9828 break;
9829 }
9830 return std::nullopt;
9831 }
9832
9833 std::optional<ExpressionEvaluationContextRecord::InitializationContext>
9835 assert(!ExprEvalContexts.empty() &&
9836 "Must be in an expression evaluation context");
9837 std::optional<ExpressionEvaluationContextRecord::InitializationContext> Res;
9838 for (auto &Ctx : llvm::reverse(ExprEvalContexts)) {
9840 !Ctx.DelayedDefaultInitializationContext && Res)
9841 break;
9842 if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
9843 Ctx.isUnevaluated())
9844 break;
9845 Res = Ctx.DelayedDefaultInitializationContext;
9846 }
9847 return Res;
9848 }
9849
9850 /// RAII class used to determine whether SFINAE has
9851 /// trapped any errors that occur during template argument
9852 /// deduction.
9854 Sema &SemaRef;
9855 unsigned PrevSFINAEErrors;
9856 bool PrevInNonInstantiationSFINAEContext;
9857 bool PrevAccessCheckingSFINAE;
9858 bool PrevLastDiagnosticIgnored;
9859
9860 public:
9861 explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
9862 : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
9863 PrevInNonInstantiationSFINAEContext(
9865 PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
9866 PrevLastDiagnosticIgnored(
9867 SemaRef.getDiagnostics().isLastDiagnosticIgnored())
9868 {
9869 if (!SemaRef.isSFINAEContext())
9870 SemaRef.InNonInstantiationSFINAEContext = true;
9872 }
9873
9875 SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
9877 = PrevInNonInstantiationSFINAEContext;
9878 SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
9880 PrevLastDiagnosticIgnored);
9881 }
9882
9883 /// Determine whether any SFINAE errors have been trapped.
9884 bool hasErrorOccurred() const {
9885 return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
9886 }
9887 };
9888
9889 /// RAII class used to indicate that we are performing provisional
9890 /// semantic analysis to determine the validity of a construct, so
9891 /// typo-correction and diagnostics in the immediate context (not within
9892 /// implicitly-instantiated templates) should be suppressed.
9894 Sema &SemaRef;
9895 // FIXME: Using a SFINAETrap for this is a hack.
9896 SFINAETrap Trap;
9897 bool PrevDisableTypoCorrection;
9898 public:
9899 explicit TentativeAnalysisScope(Sema &SemaRef)
9900 : SemaRef(SemaRef), Trap(SemaRef, true),
9901 PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
9902 SemaRef.DisableTypoCorrection = true;
9903 }
9905 SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
9906 }
9907 };
9908
9909 /// The current instantiation scope used to store local
9910 /// variables.
9912
9913 /// Tracks whether we are in a context where typo correction is
9914 /// disabled.
9916
9917 /// The number of typos corrected by CorrectTypo.
9919
9920 typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
9921 typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
9922
9923 /// A cache containing identifiers for which typo correction failed and
9924 /// their locations, so that repeated attempts to correct an identifier in a
9925 /// given location are ignored if typo correction already failed for it.
9927
9928 /// Worker object for performing CFG-based warnings.
9931
9932 /// An entity for which implicit template instantiation is required.
9933 ///
9934 /// The source location associated with the declaration is the first place in
9935 /// the source code where the declaration was "used". It is not necessarily
9936 /// the point of instantiation (which will be either before or after the
9937 /// namespace-scope declaration that triggered this implicit instantiation),
9938 /// However, it is the location that diagnostics should generally refer to,
9939 /// because users will need to know what code triggered the instantiation.
9940 typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
9941
9942 /// The queue of implicit template instantiations that are required
9943 /// but have not yet been performed.
9944 std::deque<PendingImplicitInstantiation> PendingInstantiations;
9945
9946 /// Queue of implicit template instantiations that cannot be performed
9947 /// eagerly.
9949
9953
9955 public:
9957 : S(S), Enabled(Enabled) {
9958 if (!Enabled) return;
9959
9960 S.SavedPendingInstantiations.emplace_back();
9961 S.SavedPendingInstantiations.back().swap(S.PendingInstantiations);
9962
9963 S.SavedVTableUses.emplace_back();
9964 S.SavedVTableUses.back().swap(S.VTableUses);
9965 }
9966
9967 void perform() {
9968 if (Enabled) {
9969 S.DefineUsedVTables();
9970 S.PerformPendingInstantiations();
9971 }
9972 }
9973
9975 if (!Enabled) return;
9976
9977 // Restore the set of pending vtables.
9978 assert(S.VTableUses.empty() &&
9979 "VTableUses should be empty before it is discarded.");
9980 S.VTableUses.swap(S.SavedVTableUses.back());
9981 S.SavedVTableUses.pop_back();
9982
9983 // Restore the set of pending implicit instantiations.
9984 if (S.TUKind != TU_Prefix || !S.LangOpts.PCHInstantiateTemplates) {
9985 assert(S.PendingInstantiations.empty() &&
9986 "PendingInstantiations should be empty before it is discarded.");
9987 S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
9988 S.SavedPendingInstantiations.pop_back();
9989 } else {
9990 // Template instantiations in the PCH may be delayed until the TU.
9991 S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
9992 S.PendingInstantiations.insert(
9993 S.PendingInstantiations.end(),
9994 S.SavedPendingInstantiations.back().begin(),
9995 S.SavedPendingInstantiations.back().end());
9996 S.SavedPendingInstantiations.pop_back();
9997 }
9998 }
9999
10000 private:
10001 Sema &S;
10002 bool Enabled;
10003 };
10004
10005 /// The queue of implicit template instantiations that are required
10006 /// and must be performed within the current local scope.
10007 ///
10008 /// This queue is only used for member functions of local classes in
10009 /// templates, which must be instantiated in the same scope as their
10010 /// enclosing function, so that they can reference function-local
10011 /// types, static variables, enumerators, etc.
10012 std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
10013
10015 public:
10017 SavedPendingLocalImplicitInstantiations.swap(
10018 S.PendingLocalImplicitInstantiations);
10019 }
10020
10021 void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
10022
10024 assert(S.PendingLocalImplicitInstantiations.empty() &&
10025 "there shouldn't be any pending local implicit instantiations");
10026 SavedPendingLocalImplicitInstantiations.swap(
10027 S.PendingLocalImplicitInstantiations);
10028 }
10029
10030 private:
10031 Sema &S;
10032 std::deque<PendingImplicitInstantiation>
10033 SavedPendingLocalImplicitInstantiations;
10034 };
10035
10036 /// A helper class for building up ExtParameterInfos.
10039 bool HasInteresting = false;
10040
10041 public:
10042 /// Set the ExtParameterInfo for the parameter at the given index,
10043 ///
10044 void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
10045 assert(Infos.size() <= index);
10046 Infos.resize(index);
10047 Infos.push_back(info);
10048
10049 if (!HasInteresting)
10050 HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
10051 }
10052
10053 /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
10054 /// ExtParameterInfo array we've built up.
10056 getPointerOrNull(unsigned numParams) {
10057 if (!HasInteresting) return nullptr;
10058 Infos.resize(numParams);
10059 return Infos.data();
10060 }
10061 };
10062
10063 void PerformPendingInstantiations(bool LocalOnly = false);
10064
10066 const MultiLevelTemplateArgumentList &TemplateArgs,
10067 SourceLocation Loc, DeclarationName Entity,
10068 bool AllowDeducedTST = false);
10069
10071 const MultiLevelTemplateArgumentList &TemplateArgs,
10072 SourceLocation Loc, DeclarationName Entity);
10073
10075 const MultiLevelTemplateArgumentList &TemplateArgs,
10076 SourceLocation Loc, DeclarationName Entity);
10077
10079 TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs,
10080 SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext,
10081 Qualifiers ThisTypeQuals, bool EvaluateConstraints = true);
10082 void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
10083 const MultiLevelTemplateArgumentList &Args);
10086 SmallVectorImpl<QualType> &ExceptionStorage,
10087 const MultiLevelTemplateArgumentList &Args);
10088 ParmVarDecl *
10090 const MultiLevelTemplateArgumentList &TemplateArgs,
10091 int indexAdjustment, std::optional<unsigned> NumExpansions,
10092 bool ExpectParameterPack, bool EvaluateConstraints = true);
10094 const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
10095 const MultiLevelTemplateArgumentList &TemplateArgs,
10096 SmallVectorImpl<QualType> &ParamTypes,
10098 ExtParameterInfoBuilder &ParamInfos);
10100 const MultiLevelTemplateArgumentList &TemplateArgs,
10101 bool ForCallExpr = false);
10103 const MultiLevelTemplateArgumentList &TemplateArgs);
10104
10105 // A RAII type used by the TemplateDeclInstantiator and TemplateInstantiator
10106 // to disable constraint evaluation, then restore the state.
10107 template <typename InstTy> struct ConstraintEvalRAII {
10108 InstTy &TI;
10110
10112 : TI(TI), OldValue(TI.getEvaluateConstraints()) {
10113 TI.setEvaluateConstraints(false);
10114 }
10115 ~ConstraintEvalRAII() { TI.setEvaluateConstraints(OldValue); }
10116 };
10117
10118 // Unlike the above, this evaluates constraints, which should only happen at
10119 // 'constraint checking' time.
10122 const MultiLevelTemplateArgumentList &TemplateArgs);
10123
10124 /// Substitute the given template arguments into a list of
10125 /// expressions, expanding pack expansions if required.
10126 ///
10127 /// \param Exprs The list of expressions to substitute into.
10128 ///
10129 /// \param IsCall Whether this is some form of call, in which case
10130 /// default arguments will be dropped.
10131 ///
10132 /// \param TemplateArgs The set of template arguments to substitute.
10133 ///
10134 /// \param Outputs Will receive all of the substituted arguments.
10135 ///
10136 /// \returns true if an error occurred, false otherwise.
10137 bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
10138 const MultiLevelTemplateArgumentList &TemplateArgs,
10139 SmallVectorImpl<Expr *> &Outputs);
10140
10142 const MultiLevelTemplateArgumentList &TemplateArgs);
10143
10146 const MultiLevelTemplateArgumentList &TemplateArgs,
10147 bool EvaluateConstraints = true);
10148
10149 bool
10151 const MultiLevelTemplateArgumentList &TemplateArgs,
10152 TemplateArgumentListInfo &Outputs);
10153
10154 Decl *SubstDecl(Decl *D, DeclContext *Owner,
10155 const MultiLevelTemplateArgumentList &TemplateArgs);
10156
10157 /// Substitute the name and return type of a defaulted 'operator<=>' to form
10158 /// an implicit 'operator=='.
10160 FunctionDecl *Spaceship);
10161
10163 const MultiLevelTemplateArgumentList &TemplateArgs,
10164 bool CXXDirectInit);
10165
10166 bool
10167 SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
10168 CXXRecordDecl *Pattern,
10169 const MultiLevelTemplateArgumentList &TemplateArgs);
10170
10171 bool
10172 InstantiateClass(SourceLocation PointOfInstantiation,
10173 CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
10174 const MultiLevelTemplateArgumentList &TemplateArgs,
10176 bool Complain = true);
10177
10178 bool InstantiateEnum(SourceLocation PointOfInstantiation,
10179 EnumDecl *Instantiation, EnumDecl *Pattern,
10180 const MultiLevelTemplateArgumentList &TemplateArgs,
10182
10184 SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
10185 FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
10186
10198
10199 void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
10200 const Decl *Pattern, Decl *Inst,
10201 LateInstantiatedAttrVec *LateAttrs = nullptr,
10202 LocalInstantiationScope *OuterMostScope = nullptr);
10203 void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst);
10204
10205 void
10207 const Decl *Pattern, Decl *Inst,
10208 LateInstantiatedAttrVec *LateAttrs = nullptr,
10209 LocalInstantiationScope *OuterMostScope = nullptr);
10210
10212
10214 SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
10215
10216 bool
10218 ClassTemplateSpecializationDecl *ClassTemplateSpec,
10220 bool Complain = true);
10221
10222 void InstantiateClassMembers(SourceLocation PointOfInstantiation,
10223 CXXRecordDecl *Instantiation,
10224 const MultiLevelTemplateArgumentList &TemplateArgs,
10226
10228 SourceLocation PointOfInstantiation,
10229 ClassTemplateSpecializationDecl *ClassTemplateSpec,
10231
10234 const MultiLevelTemplateArgumentList &TemplateArgs);
10235
10238 const MultiLevelTemplateArgumentList &TemplateArgs);
10241 SourceLocation Loc,
10242 const MultiLevelTemplateArgumentList &TemplateArgs);
10243
10245 const MultiLevelTemplateArgumentList &TemplateArgs,
10246 bool EvaluateConstraint);
10247
10249 ParmVarDecl *Param);
10250 void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
10251 FunctionDecl *Function);
10253 SourceLocation PointOfInstantiation, FunctionDecl *Decl,
10254 ArrayRef<TemplateArgument> TemplateArgs,
10255 ConstraintSatisfaction &Satisfaction);
10257 const TemplateArgumentList *Args,
10258 SourceLocation Loc);
10259 void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
10260 FunctionDecl *Function,
10261 bool Recursive = false,
10262 bool DefinitionRequired = false,
10263 bool AtEndOfTU = false);
10266 const TemplateArgumentList &TemplateArgList,
10267 const TemplateArgumentListInfo &TemplateArgsInfo,
10269 SourceLocation PointOfInstantiation,
10270 LateInstantiatedAttrVec *LateAttrs = nullptr,
10271 LocalInstantiationScope *StartingScope = nullptr);
10273 VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
10274 const MultiLevelTemplateArgumentList &TemplateArgs);
10275 void
10277 const MultiLevelTemplateArgumentList &TemplateArgs,
10278 LateInstantiatedAttrVec *LateAttrs,
10279 DeclContext *Owner,
10280 LocalInstantiationScope *StartingScope,
10281 bool InstantiatingVarTemplate = false,
10282 VarTemplateSpecializationDecl *PrevVTSD = nullptr);
10283
10285 VarDecl *Var, VarDecl *OldVar,
10286 const MultiLevelTemplateArgumentList &TemplateArgs);
10287 void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
10288 VarDecl *Var, bool Recursive = false,
10289 bool DefinitionRequired = false,
10290 bool AtEndOfTU = false);
10291
10293 const CXXConstructorDecl *Tmpl,
10294 const MultiLevelTemplateArgumentList &TemplateArgs);
10295
10297 const MultiLevelTemplateArgumentList &TemplateArgs,
10298 bool FindingInstantiatedContext = false);
10300 const MultiLevelTemplateArgumentList &TemplateArgs);
10301
10302 // Objective-C declarations.
10313
10315 ObjCTypeParamVariance variance,
10316 SourceLocation varianceLoc,
10317 unsigned index,
10318 IdentifierInfo *paramName,
10319 SourceLocation paramLoc,
10320 SourceLocation colonLoc,
10321 ParsedType typeBound);
10322
10324 ArrayRef<Decl *> typeParams,
10325 SourceLocation rAngleLoc);
10326 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
10327
10329 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
10330 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
10331 IdentifierInfo *SuperName, SourceLocation SuperLoc,
10332 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
10333 Decl *const *ProtoRefs, unsigned NumProtoRefs,
10334 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
10335 const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
10336
10338 SourceLocation AtInterfaceLoc,
10339 ObjCInterfaceDecl *IDecl,
10340 IdentifierInfo *ClassName,
10341 SourceLocation ClassLoc,
10342 IdentifierInfo *SuperName,
10343 SourceLocation SuperLoc,
10344 ArrayRef<ParsedType> SuperTypeArgs,
10345 SourceRange SuperTypeArgsRange);
10346
10348 SmallVectorImpl<SourceLocation> &ProtocolLocs,
10349 IdentifierInfo *SuperName,
10350 SourceLocation SuperLoc);
10351
10353 SourceLocation AtCompatibilityAliasLoc,
10354 IdentifierInfo *AliasName, SourceLocation AliasLocation,
10355 IdentifierInfo *ClassName, SourceLocation ClassLocation);
10356
10358 IdentifierInfo *PName,
10359 SourceLocation &PLoc, SourceLocation PrevLoc,
10360 const ObjCList<ObjCProtocolDecl> &PList);
10361
10363 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
10364 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
10365 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
10366 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
10367 SkipBodyInfo *SkipBody);
10368
10370 SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
10371 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
10372 IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
10373 Decl *const *ProtoRefs, unsigned NumProtoRefs,
10374 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
10375 const ParsedAttributesView &AttrList);
10376
10378 SourceLocation AtClassImplLoc, IdentifierInfo *ClassName,
10379 SourceLocation ClassLoc, IdentifierInfo *SuperClassname,
10380 SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
10381
10383 SourceLocation AtCatImplLoc, IdentifierInfo *ClassName,
10384 SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc,
10385 const ParsedAttributesView &AttrList);
10386
10388 ArrayRef<Decl *> Decls);
10389
10391 IdentifierInfo **IdentList,
10392 SourceLocation *IdentLocs,
10393 ArrayRef<ObjCTypeParamList *> TypeParamLists,
10394 unsigned NumElts);
10395
10399 const ParsedAttributesView &attrList);
10400
10401 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
10402 ArrayRef<IdentifierLocPair> ProtocolId,
10403 SmallVectorImpl<Decl *> &Protocols);
10404
10406 SourceLocation ProtocolLoc,
10407 IdentifierInfo *TypeArgId,
10408 SourceLocation TypeArgLoc,
10409 bool SelectProtocolFirst = false);
10410
10411 /// Given a list of identifiers (and their locations), resolve the
10412 /// names to either Objective-C protocol qualifiers or type
10413 /// arguments, as appropriate.
10415 Scope *S,
10416 ParsedType baseType,
10417 SourceLocation lAngleLoc,
10418 ArrayRef<IdentifierInfo *> identifiers,
10419 ArrayRef<SourceLocation> identifierLocs,
10420 SourceLocation rAngleLoc,
10421 SourceLocation &typeArgsLAngleLoc,
10423 SourceLocation &typeArgsRAngleLoc,
10424 SourceLocation &protocolLAngleLoc,
10425 SmallVectorImpl<Decl *> &protocols,
10426 SourceLocation &protocolRAngleLoc,
10427 bool warnOnIncompleteProtocols);
10428
10429 /// Build a an Objective-C protocol-qualified 'id' type where no
10430 /// base type was specified.
10432 SourceLocation lAngleLoc,
10433 ArrayRef<Decl *> protocols,
10434 ArrayRef<SourceLocation> protocolLocs,
10435 SourceLocation rAngleLoc);
10436
10437 /// Build a specialized and/or protocol-qualified Objective-C type.
10439 Scope *S,
10440 SourceLocation Loc,
10441 ParsedType BaseType,
10442 SourceLocation TypeArgsLAngleLoc,
10443 ArrayRef<ParsedType> TypeArgs,
10444 SourceLocation TypeArgsRAngleLoc,
10445 SourceLocation ProtocolLAngleLoc,
10446 ArrayRef<Decl *> Protocols,
10447 ArrayRef<SourceLocation> ProtocolLocs,
10448 SourceLocation ProtocolRAngleLoc);
10449
10450 /// Build an Objective-C type parameter type.
10452 SourceLocation ProtocolLAngleLoc,
10454 ArrayRef<SourceLocation> ProtocolLocs,
10455 SourceLocation ProtocolRAngleLoc,
10456 bool FailOnError = false);
10457
10458 /// Build an Objective-C object pointer type.
10460 QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
10461 ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
10462 SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
10463 ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
10464 bool FailOnError, bool Rebuilding);
10465
10466 /// Ensure attributes are consistent with type.
10467 /// \param [in, out] Attributes The attributes to check; they will
10468 /// be modified to be consistent with \p PropertyTy.
10469 void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
10470 SourceLocation Loc,
10471 unsigned &Attributes,
10472 bool propertyInPrimaryClass);
10473
10474 /// Process the specified property declaration and create decls for the
10475 /// setters and getters as needed.
10476 /// \param property The property declaration being processed
10477 void ProcessPropertyDecl(ObjCPropertyDecl *property);
10478
10479
10481 ObjCPropertyDecl *SuperProperty,
10482 const IdentifierInfo *Name,
10483 bool OverridingProtocolProperty);
10484
10486 ObjCInterfaceDecl *ID);
10487
10488 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
10489 ArrayRef<Decl *> allMethods = std::nullopt,
10490 ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
10491
10493 SourceLocation LParenLoc,
10494 FieldDeclarator &FD, ObjCDeclSpec &ODS,
10495 Selector GetterSel, Selector SetterSel,
10496 tok::ObjCKeywordKind MethodImplKind,
10497 DeclContext *lexicalDC = nullptr);
10498
10500 SourceLocation AtLoc,
10501 SourceLocation PropertyLoc,
10502 bool ImplKind,
10503 IdentifierInfo *PropertyId,
10504 IdentifierInfo *PropertyIvar,
10505 SourceLocation PropertyIvarLoc,
10506 ObjCPropertyQueryKind QueryKind);
10507
10516
10520 // The Type is null if no type was specified, and the DeclSpec is invalid
10521 // in this case.
10524
10525 /// ArgAttrs - Attribute list for this argument.
10527 };
10528
10530 Scope *S,
10531 SourceLocation BeginLoc, // location of the + or -.
10532 SourceLocation EndLoc, // location of the ; or {.
10533 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
10534 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
10535 // optional arguments. The number of types/arguments is obtained
10536 // from the Sel.getNumArgs().
10537 ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
10538 unsigned CNumArgs, // c-style args
10539 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
10540 bool isVariadic, bool MethodDefinition);
10541
10543 const ObjCObjectPointerType *OPT,
10544 bool IsInstance);
10546 bool IsInstance);
10547
10548 bool CheckARCMethodDecl(ObjCMethodDecl *method);
10550
10552
10555 Expr *BaseExpr,
10556 SourceLocation OpLoc,
10557 DeclarationName MemberName,
10558 SourceLocation MemberLoc,
10559 SourceLocation SuperLoc, QualType SuperType,
10560 bool Super);
10561
10564 IdentifierInfo &propertyName,
10565 SourceLocation receiverNameLoc,
10566 SourceLocation propertyNameLoc);
10567
10569
10570 /// Describes the kind of message expression indicated by a message
10571 /// send that starts with an identifier.
10573 /// The message is sent to 'super'.
10575 /// The message is an instance message.
10577 /// The message is a class message, and the identifier is a type
10578 /// name.
10581
10583 IdentifierInfo *Name,
10584 SourceLocation NameLoc,
10585 bool IsSuper,
10586 bool HasTrailingDot,
10587 ParsedType &ReceiverType);
10588
10590 Selector Sel,
10591 SourceLocation LBracLoc,
10592 ArrayRef<SourceLocation> SelectorLocs,
10593 SourceLocation RBracLoc,
10594 MultiExprArg Args);
10595
10597 QualType ReceiverType,
10598 SourceLocation SuperLoc,
10599 Selector Sel,
10600 ObjCMethodDecl *Method,
10601 SourceLocation LBracLoc,
10602 ArrayRef<SourceLocation> SelectorLocs,
10603 SourceLocation RBracLoc,
10604 MultiExprArg Args,
10605 bool isImplicit = false);
10606
10608 bool isSuperReceiver,
10609 SourceLocation Loc,
10610 Selector Sel,
10611 ObjCMethodDecl *Method,
10612 MultiExprArg Args);
10613
10615 ParsedType Receiver,
10616 Selector Sel,
10617 SourceLocation LBracLoc,
10618 ArrayRef<SourceLocation> SelectorLocs,
10619 SourceLocation RBracLoc,
10620 MultiExprArg Args);
10621
10623 QualType ReceiverType,
10624 SourceLocation SuperLoc,
10625 Selector Sel,
10626 ObjCMethodDecl *Method,
10627 SourceLocation LBracLoc,
10628 ArrayRef<SourceLocation> SelectorLocs,
10629 SourceLocation RBracLoc,
10630 MultiExprArg Args,
10631 bool isImplicit = false);
10632
10634 QualType ReceiverType,
10635 SourceLocation Loc,
10636 Selector Sel,
10637 ObjCMethodDecl *Method,
10638 MultiExprArg Args);
10639
10641 Expr *Receiver,
10642 Selector Sel,
10643 SourceLocation LBracLoc,
10644 ArrayRef<SourceLocation> SelectorLocs,
10645 SourceLocation RBracLoc,
10646 MultiExprArg Args);
10647
10649 ObjCBridgeCastKind Kind,
10650 SourceLocation BridgeKeywordLoc,
10651 TypeSourceInfo *TSInfo,
10652 Expr *SubExpr);
10653
10655 SourceLocation LParenLoc,
10656 ObjCBridgeCastKind Kind,
10657 SourceLocation BridgeKeywordLoc,
10659 SourceLocation RParenLoc,
10660 Expr *SubExpr);
10661
10663
10665
10667 CastKind &Kind);
10668
10670 QualType DestType, QualType SrcType,
10671 ObjCInterfaceDecl *&RelatedClass,
10672 ObjCMethodDecl *&ClassMethod,
10673 ObjCMethodDecl *&InstanceMethod,
10674 TypedefNameDecl *&TDNDecl,
10675 bool CfToNs, bool Diagnose = true);
10676
10678 QualType DestType, QualType SrcType,
10679 Expr *&SrcExpr, bool Diagnose = true);
10680
10681 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
10682 bool Diagnose = true);
10683
10684 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
10685
10686 /// Check whether the given new method is a valid override of the
10687 /// given overridden method, and set any properties that should be inherited.
10689 const ObjCMethodDecl *Overridden);
10690
10691 /// Describes the compatibility of a result type with its method.
10697
10699 ObjCMethodDecl *overridden);
10700
10702 ObjCInterfaceDecl *CurrentClass,
10704
10706 POAK_Native, // #pragma options align=native
10707 POAK_Natural, // #pragma options align=natural
10708 POAK_Packed, // #pragma options align=packed
10709 POAK_Power, // #pragma options align=power
10710 POAK_Mac68k, // #pragma options align=mac68k
10711 POAK_Reset // #pragma options align=reset
10713
10714 /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
10717 PragmaClangSectionKind SecKind, StringRef SecName);
10718
10719 /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
10721 SourceLocation PragmaLoc);
10722
10723 /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
10724 void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
10725 StringRef SlotLabel, Expr *Alignment);
10726
10731
10733 SourceLocation IncludeLoc);
10735
10736 /// ActOnPragmaMSStrictGuardStackCheck - Called on well formed \#pragma
10737 /// strict_gs_check.
10739 PragmaMsStackAction Action,
10740 bool Value);
10741
10742 /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
10744
10745 /// ActOnPragmaMSComment - Called on well formed
10746 /// \#pragma comment(kind, "arg").
10748 StringRef Arg);
10749
10750 /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
10751 /// pointers_to_members(representation method[, general purpose
10752 /// representation]).
10755 SourceLocation PragmaLoc);
10756
10757 /// Called on well formed \#pragma vtordisp().
10758 void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action,
10759 SourceLocation PragmaLoc,
10761
10768
10769 bool UnifySection(StringRef SectionName, int SectionFlags,
10770 NamedDecl *TheDecl);
10771 bool UnifySection(StringRef SectionName,
10772 int SectionFlags,
10773 SourceLocation PragmaSectionLocation);
10774
10775 /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
10776 void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
10777 PragmaMsStackAction Action,
10778 llvm::StringRef StackSlotLabel,
10779 StringLiteral *SegmentName,
10780 llvm::StringRef PragmaName);
10781
10782 /// Called on well formed \#pragma section().
10783 void ActOnPragmaMSSection(SourceLocation PragmaLocation,
10784 int SectionFlags, StringLiteral *SegmentName);
10785
10786 /// Called on well-formed \#pragma init_seg().
10787 void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
10788 StringLiteral *SegmentName);
10789
10790 /// Called on well-formed \#pragma alloc_text().
10792 SourceLocation PragmaLocation, StringRef Section,
10793 const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
10794 &Functions);
10795
10796 /// Called on #pragma clang __debug dump II
10798
10799 /// Called on #pragma clang __debug dump E
10800 void ActOnPragmaDump(Expr *E);
10801
10802 /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
10803 void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
10804 StringRef Value);
10805
10806 /// Are precise floating point semantics currently enabled?
10808 return !CurFPFeatures.getAllowFPReassociate() &&
10809 !CurFPFeatures.getNoSignedZero() &&
10810 !CurFPFeatures.getAllowReciprocal() &&
10811 !CurFPFeatures.getAllowApproxFunc();
10812 }
10813
10816
10817 /// ActOnPragmaFloatControl - Call on well-formed \#pragma float_control
10818 void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action,
10820
10821 /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
10823 Scope *curScope,
10824 SourceLocation PragmaLoc);
10825
10826 /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
10827 void ActOnPragmaVisibility(const IdentifierInfo* VisType,
10828 SourceLocation PragmaLoc);
10829
10831 SourceLocation Loc);
10832 void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W);
10833
10834 /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
10835 void ActOnPragmaWeakID(IdentifierInfo* WeakName,
10836 SourceLocation PragmaLoc,
10837 SourceLocation WeakNameLoc);
10838
10839 /// ActOnPragmaRedefineExtname - Called on well formed
10840 /// \#pragma redefine_extname oldname newname.
10842 IdentifierInfo* AliasName,
10843 SourceLocation PragmaLoc,
10844 SourceLocation WeakNameLoc,
10845 SourceLocation AliasNameLoc);
10846
10847 /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
10848 void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
10849 IdentifierInfo* AliasName,
10850 SourceLocation PragmaLoc,
10851 SourceLocation WeakNameLoc,
10852 SourceLocation AliasNameLoc);
10853
10854 /// ActOnPragmaFPContract - Called on well formed
10855 /// \#pragma {STDC,OPENCL} FP_CONTRACT and
10856 /// \#pragma clang fp contract
10858
10859 /// Called on well formed
10860 /// \#pragma clang fp reassociate
10861 void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled);
10862
10863 /// ActOnPragmaFenvAccess - Called on well formed
10864 /// \#pragma STDC FENV_ACCESS
10865 void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled);
10866
10867 /// Called on well formed '\#pragma clang fp' that has option 'exceptions'.
10870
10871 /// Called to set constant rounding mode for floating point operations.
10872 void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode);
10873
10874 /// Called to set exception behavior for floating point operations.
10876
10877 /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
10878 /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
10880
10881 /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
10883
10884 /// PushNamespaceVisibilityAttr - Note that we've entered a
10885 /// namespace with a visibility attribute.
10886 void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
10887 SourceLocation Loc);
10888
10889 /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
10890 /// add an appropriate visibility attribute.
10892
10893 /// PopPragmaVisibility - Pop the top element of the visibility stack; used
10894 /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
10895 void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
10896
10897 /// FreeVisContext - Deallocate and null out VisContext.
10898 void FreeVisContext();
10899
10900 /// AddCFAuditedAttribute - Check whether we're currently within
10901 /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
10902 /// the appropriate attribute.
10903 void AddCFAuditedAttribute(Decl *D);
10904
10906 SourceLocation PragmaLoc,
10909 const IdentifierInfo *Namespace);
10910
10911 /// Called on well-formed '\#pragma clang attribute pop'.
10913 const IdentifierInfo *Namespace);
10914
10915 /// Adds the attributes that have been specified using the
10916 /// '\#pragma clang attribute push' directives to the given declaration.
10917 void AddPragmaAttributes(Scope *S, Decl *D);
10918
10920
10921 /// Called on well formed \#pragma clang optimize.
10922 void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
10923
10924 /// #pragma optimize("[optimization-list]", on | off).
10925 void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn);
10926
10927 /// Call on well formed \#pragma function.
10928 void
10930 const llvm::SmallVectorImpl<StringRef> &NoBuiltins);
10931
10932 /// Get the location for the currently active "\#pragma clang optimize
10933 /// off". If this location is invalid, then the state of the pragma is "on".
10937
10938 /// Only called on function definitions; if there is a pragma in scope
10939 /// with the effect of a range-based optnone, consider marking the function
10940 /// with attribute optnone.
10942
10943 /// Only called on function definitions; if there is a `#pragma alloc_text`
10944 /// that decides which code section the function should be in, add
10945 /// attribute section to the function.
10947
10948 /// Adds the 'optnone' attribute to the function declaration if there
10949 /// are no conflicts; Loc represents the location causing the 'optnone'
10950 /// attribute to be added (usually because of a pragma).
10952
10953 /// Only called on function definitions; if there is a MSVC #pragma optimize
10954 /// in scope, consider changing the function's attributes based on the
10955 /// optimization list passed to the pragma.
10957
10958 /// Only called on function definitions; if there is a pragma in scope
10959 /// with the effect of a range-based no_builtin, consider marking the function
10960 /// with attribute no_builtin.
10962
10963 /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
10964 void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
10965 bool IsPackExpansion);
10967 bool IsPackExpansion);
10968
10969 /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
10970 /// declaration.
10971 void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
10972 Expr *OE);
10973
10974 /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
10975 /// declaration.
10976 void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
10977 Expr *ParamExpr);
10978
10979 /// AddAlignValueAttr - Adds an align_value attribute to a particular
10980 /// declaration.
10981 void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E);
10982
10983 /// AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
10984 void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI,
10985 StringRef Annot, MutableArrayRef<Expr *> Args);
10986
10987 /// ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs
10988 /// (unless they are value dependent or type dependent). Returns false
10989 /// and emits a diagnostic if one or more of the arguments could not be
10990 /// folded into a constant.
10993
10994 /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
10995 /// declaration.
10996 void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
10997 Expr *MaxThreads, Expr *MinBlocks);
10998
10999 /// AddModeAttr - Adds a mode attribute to a particular declaration.
11000 void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name,
11001 bool InInstantiation = false);
11002
11003 void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
11004 ParameterABI ABI);
11005
11006 enum class RetainOwnershipKind {NS, CF, OS};
11007 void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
11008 RetainOwnershipKind K, bool IsTemplateInstantiation);
11009
11010 /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
11011 /// attribute to a particular declaration.
11013 Expr *Min, Expr *Max);
11014
11015 /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
11016 /// particular declaration.
11018 Expr *Min, Expr *Max);
11019
11021
11022 //===--------------------------------------------------------------------===//
11023 // C++ Coroutines
11024 //
11026 StringRef Keyword);
11030
11033 UnresolvedLookupExpr *Lookup);
11035 Expr *Awaiter, bool IsImplicit = false);
11037 UnresolvedLookupExpr *Lookup);
11040 bool IsImplicit = false);
11045 /// Lookup 'coroutine_traits' in std namespace and std::experimental
11046 /// namespace. The namespace found is recorded in Namespace.
11048 SourceLocation FuncLoc);
11049 /// Check that the expression co_await promise.final_suspend() shall not be
11050 /// potentially-throwing.
11051 bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
11052
11053 //===--------------------------------------------------------------------===//
11054 // OpenMP directives and clauses.
11055 //
11056private:
11057 void *VarDataSharingAttributesStack;
11058
11059 struct DeclareTargetContextInfo {
11060 struct MapInfo {
11061 OMPDeclareTargetDeclAttr::MapTypeTy MT;
11063 };
11064 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
11065 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
11066
11067 /// The 'device_type' as parsed from the clause.
11068 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
11069
11070 /// The directive kind, `begin declare target` or `declare target`.
11072
11073 /// The directive with indirect clause.
11074 std::optional<Expr *> Indirect;
11075
11076 /// The directive location.
11077 SourceLocation Loc;
11078
11079 DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
11080 : Kind(Kind), Loc(Loc) {}
11081 };
11082
11083 /// Number of nested '#pragma omp declare target' directives.
11084 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
11085
11086 /// Initialization of data-sharing attributes stack.
11087 void InitDataSharingAttributesStack();
11088 void DestroyDataSharingAttributesStack();
11089
11090 /// Returns OpenMP nesting level for current directive.
11091 unsigned getOpenMPNestingLevel() const;
11092
11093 /// Adjusts the function scopes index for the target-based regions.
11094 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
11095 unsigned Level) const;
11096
11097 /// Returns the number of scopes associated with the construct on the given
11098 /// OpenMP level.
11099 int getNumberOfConstructScopes(unsigned Level) const;
11100
11101 /// Push new OpenMP function region for non-capturing function.
11102 void pushOpenMPFunctionRegion();
11103
11104 /// Pop OpenMP function region for non-capturing function.
11105 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
11106
11107 /// Analyzes and checks a loop nest for use by a loop transformation.
11108 ///
11109 /// \param Kind The loop transformation directive kind.
11110 /// \param NumLoops How many nested loops the directive is expecting.
11111 /// \param AStmt Associated statement of the transformation directive.
11112 /// \param LoopHelpers [out] The loop analysis result.
11113 /// \param Body [out] The body code nested in \p NumLoops loop.
11114 /// \param OriginalInits [out] Collection of statements and declarations that
11115 /// must have been executed/declared before entering the
11116 /// loop.
11117 ///
11118 /// \return Whether there was any error.
11119 bool checkTransformableLoopNest(
11120 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
11122 Stmt *&Body,
11123 SmallVectorImpl<SmallVector<llvm::PointerUnion<Stmt *, Decl *>, 0>>
11124 &OriginalInits);
11125
11126 /// Helper to keep information about the current `omp begin/end declare
11127 /// variant` nesting.
11128 struct OMPDeclareVariantScope {
11129 /// The associated OpenMP context selector.
11130 OMPTraitInfo *TI;
11131
11132 /// The associated OpenMP context selector mangling.
11133 std::string NameSuffix;
11134
11135 OMPDeclareVariantScope(OMPTraitInfo &TI);
11136 };
11137
11138 /// Return the OMPTraitInfo for the surrounding scope, if any.
11139 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
11140 return OMPDeclareVariantScopes.empty() ? nullptr
11141 : OMPDeclareVariantScopes.back().TI;
11142 }
11143
11144 /// The current `omp begin/end declare variant` scopes.
11145 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
11146
11147 /// The current `omp begin/end assumes` scopes.
11148 SmallVector<AssumptionAttr *, 4> OMPAssumeScoped;
11149
11150 /// All `omp assumes` we encountered so far.
11151 SmallVector<AssumptionAttr *, 4> OMPAssumeGlobal;
11152
11153public:
11154 /// The declarator \p D defines a function in the scope \p S which is nested
11155 /// in an `omp begin/end declare variant` scope. In this method we create a
11156 /// declaration for \p D and rename \p D according to the OpenMP context
11157 /// selector of the surrounding scope. Return all base functions in \p Bases.
11159 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
11160 SmallVectorImpl<FunctionDecl *> &Bases);
11161
11162 /// Register \p D as specialization of all base functions in \p Bases in the
11163 /// current `omp begin/end declare variant` scope.
11165 Decl *D, SmallVectorImpl<FunctionDecl *> &Bases);
11166
11167 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
11169
11170 /// Can we exit an OpenMP declare variant scope at the moment.
11172 return !OMPDeclareVariantScopes.empty();
11173 }
11174
11177 bool StrictlyPositive = true,
11178 bool SuppressExprDiags = false);
11179
11180 /// Given the potential call expression \p Call, determine if there is a
11181 /// specialization via the OpenMP declare variant mechanism available. If
11182 /// there is, return the specialized call expression, otherwise return the
11183 /// original \p Call.
11185 SourceLocation LParenLoc, MultiExprArg ArgExprs,
11186 SourceLocation RParenLoc, Expr *ExecConfig);
11187
11188 /// Handle a `omp begin declare variant`.
11190
11191 /// Handle a `omp end declare variant`.
11193
11194 /// Checks if the variant/multiversion functions are compatible.
11196 const FunctionDecl *OldFD, const FunctionDecl *NewFD,
11197 const PartialDiagnostic &NoProtoDiagID,
11198 const PartialDiagnosticAt &NoteCausedDiagIDAt,
11199 const PartialDiagnosticAt &NoSupportDiagIDAt,
11200 const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
11201 bool ConstexprSupported, bool CLinkageMayDiffer);
11202
11203 /// Function tries to capture lambda's captured variables in the OpenMP region
11204 /// before the original lambda is captured.
11206
11207 /// Return true if the provided declaration \a VD should be captured by
11208 /// reference.
11209 /// \param Level Relative level of nested OpenMP construct for that the check
11210 /// is performed.
11211 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
11212 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
11213 unsigned OpenMPCaptureLevel) const;
11214
11215 /// Check if the specified variable is used in one of the private
11216 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
11217 /// constructs.
11218 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
11219 unsigned StopAt = 0);
11220
11221 /// The member expression(this->fd) needs to be rebuilt in the template
11222 /// instantiation to generate private copy for OpenMP when default
11223 /// clause is used. The function will return true if default
11224 /// cluse is used.
11226
11229
11230 /// If the current region is a loop-based region, mark the start of the loop
11231 /// construct.
11232 void startOpenMPLoop();
11233
11234 /// If the current region is a range loop-based region, mark the start of the
11235 /// loop construct.
11237
11238 /// Check if the specified variable is used in 'private' clause.
11239 /// \param Level Relative level of nested OpenMP construct for that the check
11240 /// is performed.
11242 unsigned CapLevel) const;
11243
11244 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
11245 /// for \p FD based on DSA for the provided corresponding captured declaration
11246 /// \p D.
11247 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
11248
11249 /// Check if the specified variable is captured by 'target' directive.
11250 /// \param Level Relative level of nested OpenMP construct for that the check
11251 /// is performed.
11252 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
11253 unsigned CaptureLevel) const;
11254
11255 /// Check if the specified global variable must be captured by outer capture
11256 /// regions.
11257 /// \param Level Relative level of nested OpenMP construct for that
11258 /// the check is performed.
11259 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
11260 unsigned CaptureLevel) const;
11261
11263 Expr *Op);
11264 /// Called on start of new data sharing attribute block.
11266 const DeclarationNameInfo &DirName, Scope *CurScope,
11267 SourceLocation Loc);
11268 /// Start analysis of clauses.
11270 /// End analysis of clauses.
11271 void EndOpenMPClause();
11272 /// Called on end of data sharing attribute block.
11273 void EndOpenMPDSABlock(Stmt *CurDirective);
11274
11275 /// Check if the current region is an OpenMP loop region and if it is,
11276 /// mark loop control variable, used in \p Init for loop initialization, as
11277 /// private by default.
11278 /// \param Init First part of the for loop.
11280
11281 /// Called on well-formed '\#pragma omp metadirective' after parsing
11282 /// of the associated statement.
11284 Stmt *AStmt, SourceLocation StartLoc,
11285 SourceLocation EndLoc);
11286
11287 // OpenMP directives and clauses.
11288 /// Called on correct id-expression from the '#pragma omp
11289 /// threadprivate'.
11291 const DeclarationNameInfo &Id,
11292 OpenMPDirectiveKind Kind);
11293 /// Called on well-formed '#pragma omp threadprivate'.
11295 SourceLocation Loc,
11296 ArrayRef<Expr *> VarList);
11297 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
11299 ArrayRef<Expr *> VarList);
11300 /// Called on well-formed '#pragma omp allocate'.
11302 ArrayRef<Expr *> VarList,
11303 ArrayRef<OMPClause *> Clauses,
11304 DeclContext *Owner = nullptr);
11305
11306 /// Called on well-formed '#pragma omp [begin] assume[s]'.
11308 OpenMPDirectiveKind DKind,
11309 ArrayRef<std::string> Assumptions,
11310 bool SkippedClauses);
11311
11312 /// Check if there is an active global `omp begin assumes` directive.
11313 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
11314
11315 /// Check if there is an active global `omp assumes` directive.
11316 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
11317
11318 /// Called on well-formed '#pragma omp end assumes'.
11320
11321 /// Called on well-formed '#pragma omp requires'.
11323 ArrayRef<OMPClause *> ClauseList);
11324 /// Check restrictions on Requires directive
11326 ArrayRef<OMPClause *> Clauses);
11327 /// Check if the specified type is allowed to be used in 'omp declare
11328 /// reduction' construct.
11331 /// Called on start of '#pragma omp declare reduction'.
11333 Scope *S, DeclContext *DC, DeclarationName Name,
11334 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
11335 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
11336 /// Initialize declare reduction construct initializer.
11338 /// Finish current declare reduction construct initializer.
11340 /// Initialize declare reduction construct initializer.
11341 /// \return omp_priv variable.
11343 /// Finish current declare reduction construct initializer.
11345 VarDecl *OmpPrivParm);
11346 /// Called at the end of '#pragma omp declare reduction'.
11348 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
11349
11350 /// Check variable declaration in 'omp declare mapper' construct.
11352 /// Check if the specified type is allowed to be used in 'omp declare
11353 /// mapper' construct.
11356 /// Called on start of '#pragma omp declare mapper'.
11358 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
11360 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
11361 Decl *PrevDeclInScope = nullptr);
11362 /// Build the mapper variable of '#pragma omp declare mapper'.
11364 QualType MapperType,
11365 SourceLocation StartLoc,
11366 DeclarationName VN);
11368 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
11370
11371 /// Called on the start of target region i.e. '#pragma omp declare target'.
11372 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
11373
11374 /// Called at the end of target region i.e. '#pragma omp end declare target'.
11375 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
11376
11377 /// Called once a target context is completed, that can be when a
11378 /// '#pragma omp end declare target' was encountered or when a
11379 /// '#pragma omp declare target' without declaration-definition-seq was
11380 /// encountered.
11381 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
11382
11383 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
11384 /// the end of a compilation unit.
11386
11387 /// Searches for the provided declaration name for OpenMP declare target
11388 /// directive.
11390 CXXScopeSpec &ScopeSpec,
11391 const DeclarationNameInfo &Id);
11392
11393 /// Called on correct id-expression from the '#pragma omp declare target'.
11395 OMPDeclareTargetDeclAttr::MapTypeTy MT,
11396 DeclareTargetContextInfo &DTCI);
11397
11398 /// Check declaration inside target region.
11399 void
11401 SourceLocation IdLoc = SourceLocation());
11402
11403 /// Adds OMPDeclareTargetDeclAttr to referenced variables in declare target
11404 /// directive.
11406
11407 /// Finishes analysis of the deferred functions calls that may be declared as
11408 /// host/nohost during device/host compilation.
11410 const FunctionDecl *Callee,
11411 SourceLocation Loc);
11412
11413 /// Return true if currently in OpenMP task with untied clause context.
11414 bool isInOpenMPTaskUntiedContext() const;
11415
11416 /// Return true inside OpenMP declare target region.
11418 return !DeclareTargetNesting.empty();
11419 }
11420 /// Return true inside OpenMP target region.
11422
11423 /// Return the number of captured regions created for an OpenMP directive.
11425
11426 /// Initialization of captured region for OpenMP region.
11427 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
11428
11429 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
11430 /// an OpenMP loop directive.
11432
11433 /// Process a canonical OpenMP loop nest that can either be a canonical
11434 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
11435 /// OpenMP loop transformation construct.
11437
11438 /// End of OpenMP region.
11439 ///
11440 /// \param S Statement associated with the current OpenMP region.
11441 /// \param Clauses List of clauses for the current OpenMP region.
11442 ///
11443 /// \returns Statement for finished OpenMP region.
11446 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
11447 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
11448 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
11449 /// Called on well-formed '\#pragma omp parallel' after parsing
11450 /// of the associated statement.
11452 Stmt *AStmt,
11453 SourceLocation StartLoc,
11454 SourceLocation EndLoc);
11456 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
11457 /// Called on well-formed '\#pragma omp simd' after parsing
11458 /// of the associated statement.
11461 SourceLocation StartLoc, SourceLocation EndLoc,
11462 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11463 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
11464 /// the associated statement.
11466 Stmt *AStmt, SourceLocation StartLoc,
11467 SourceLocation EndLoc);
11468 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
11469 /// and the associated statement.
11471 Stmt *AStmt, SourceLocation StartLoc,
11472 SourceLocation EndLoc);
11473 /// Called on well-formed '\#pragma omp for' after parsing
11474 /// of the associated statement.
11477 SourceLocation StartLoc, SourceLocation EndLoc,
11478 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11479 /// Called on well-formed '\#pragma omp for simd' after parsing
11480 /// of the associated statement.
11483 SourceLocation StartLoc, SourceLocation EndLoc,
11484 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11485 /// Called on well-formed '\#pragma omp sections' after parsing
11486 /// of the associated statement.
11488 Stmt *AStmt, SourceLocation StartLoc,
11489 SourceLocation EndLoc);
11490 /// Called on well-formed '\#pragma omp section' after parsing of the
11491 /// associated statement.
11493 SourceLocation EndLoc);
11494 /// Called on well-formed '\#pragma omp single' after parsing of the
11495 /// associated statement.
11497 Stmt *AStmt, SourceLocation StartLoc,
11498 SourceLocation EndLoc);
11499 /// Called on well-formed '\#pragma omp master' after parsing of the
11500 /// associated statement.
11502 SourceLocation EndLoc);
11503 /// Called on well-formed '\#pragma omp critical' after parsing of the
11504 /// associated statement.
11506 ArrayRef<OMPClause *> Clauses,
11507 Stmt *AStmt, SourceLocation StartLoc,
11508 SourceLocation EndLoc);
11509 /// Called on well-formed '\#pragma omp parallel for' after parsing
11510 /// of the associated statement.
11512 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11513 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11514 /// Called on well-formed '\#pragma omp parallel for simd' after
11515 /// parsing of the associated statement.
11517 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11518 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11519 /// Called on well-formed '\#pragma omp parallel master' after
11520 /// parsing of the associated statement.
11522 Stmt *AStmt,
11523 SourceLocation StartLoc,
11524 SourceLocation EndLoc);
11525 /// Called on well-formed '\#pragma omp parallel masked' after
11526 /// parsing of the associated statement.
11528 Stmt *AStmt,
11529 SourceLocation StartLoc,
11530 SourceLocation EndLoc);
11531 /// Called on well-formed '\#pragma omp parallel sections' after
11532 /// parsing of the associated statement.
11534 Stmt *AStmt,
11535 SourceLocation StartLoc,
11536 SourceLocation EndLoc);
11537 /// Called on well-formed '\#pragma omp task' after parsing of the
11538 /// associated statement.
11540 Stmt *AStmt, SourceLocation StartLoc,
11541 SourceLocation EndLoc);
11542 /// Called on well-formed '\#pragma omp taskyield'.
11544 SourceLocation EndLoc);
11545 /// Called on well-formed '\#pragma omp error'.
11546 /// Error direcitive is allowed in both declared and excutable contexts.
11547 /// Adding InExContext to identify which context is called from.
11549 SourceLocation StartLoc,
11550 SourceLocation EndLoc,
11551 bool InExContext = true);
11552 /// Called on well-formed '\#pragma omp barrier'.
11554 SourceLocation EndLoc);
11555 /// Called on well-formed '\#pragma omp taskwait'.
11557 SourceLocation StartLoc,
11558 SourceLocation EndLoc);
11559 /// Called on well-formed '\#pragma omp taskgroup'.
11561 Stmt *AStmt, SourceLocation StartLoc,
11562 SourceLocation EndLoc);
11563 /// Called on well-formed '\#pragma omp flush'.
11565 SourceLocation StartLoc,
11566 SourceLocation EndLoc);
11567 /// Called on well-formed '\#pragma omp depobj'.
11569 SourceLocation StartLoc,
11570 SourceLocation EndLoc);
11571 /// Called on well-formed '\#pragma omp scan'.
11573 SourceLocation StartLoc,
11574 SourceLocation EndLoc);
11575 /// Called on well-formed '\#pragma omp ordered' after parsing of the
11576 /// associated statement.
11578 Stmt *AStmt, SourceLocation StartLoc,
11579 SourceLocation EndLoc);
11580 /// Called on well-formed '\#pragma omp atomic' after parsing of the
11581 /// associated statement.
11583 Stmt *AStmt, SourceLocation StartLoc,
11584 SourceLocation EndLoc);
11585 /// Called on well-formed '\#pragma omp target' after parsing of the
11586 /// associated statement.
11588 Stmt *AStmt, SourceLocation StartLoc,
11589 SourceLocation EndLoc);
11590 /// Called on well-formed '\#pragma omp target data' after parsing of
11591 /// the associated statement.
11593 Stmt *AStmt, SourceLocation StartLoc,
11594 SourceLocation EndLoc);
11595 /// Called on well-formed '\#pragma omp target enter data' after
11596 /// parsing of the associated statement.
11598 SourceLocation StartLoc,
11599 SourceLocation EndLoc,
11600 Stmt *AStmt);
11601 /// Called on well-formed '\#pragma omp target exit data' after
11602 /// parsing of the associated statement.
11604 SourceLocation StartLoc,
11605 SourceLocation EndLoc,
11606 Stmt *AStmt);
11607 /// Called on well-formed '\#pragma omp target parallel' after
11608 /// parsing of the associated statement.
11610 Stmt *AStmt,
11611 SourceLocation StartLoc,
11612 SourceLocation EndLoc);
11613 /// Called on well-formed '\#pragma omp target parallel for' after
11614 /// parsing of the associated statement.
11616 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11617 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11618 /// Called on well-formed '\#pragma omp teams' after parsing of the
11619 /// associated statement.
11621 Stmt *AStmt, SourceLocation StartLoc,
11622 SourceLocation EndLoc);
11623 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
11624 /// associated statement.
11626 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11627 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11628 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
11629 /// the associated statement.
11631 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11632 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11633 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
11634 /// associated statement.
11636 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11637 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11638 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
11639 /// of the associated statement.
11641 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11642 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11643 /// Called on well-formed '\#pragma omp cancellation point'.
11646 SourceLocation EndLoc,
11647 OpenMPDirectiveKind CancelRegion);
11648 /// Called on well-formed '\#pragma omp cancel'.
11650 SourceLocation StartLoc,
11651 SourceLocation EndLoc,
11652 OpenMPDirectiveKind CancelRegion);
11653 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
11654 /// associated statement.
11657 SourceLocation StartLoc, SourceLocation EndLoc,
11658 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11659 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
11660 /// the associated statement.
11662 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11663 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11664 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
11665 /// associated statement.
11667 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11668 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11669 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
11670 /// the associated statement.
11672 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11673 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11674 /// Called on well-formed '\#pragma omp parallel master taskloop' after
11675 /// parsing of the associated statement.
11677 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11678 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11679 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
11680 /// parsing of the associated statement.
11682 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11683 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11684 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
11685 /// associated statement.
11687 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11688 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11689 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
11690 /// the associated statement.
11692 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11693 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11694 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
11695 /// parsing of the associated statement.
11697 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11698 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11699 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
11700 /// parsing of the associated statement.
11702 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11703 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11704 /// Called on well-formed '\#pragma omp distribute' after parsing
11705 /// of the associated statement.
11708 SourceLocation StartLoc, SourceLocation EndLoc,
11709 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11710 /// Called on well-formed '\#pragma omp target update'.
11712 SourceLocation StartLoc,
11713 SourceLocation EndLoc,
11714 Stmt *AStmt);
11715 /// Called on well-formed '\#pragma omp distribute parallel for' after
11716 /// parsing of the associated statement.
11718 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11719 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11720 /// Called on well-formed '\#pragma omp distribute parallel for simd'
11721 /// after parsing of the associated statement.
11723 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11724 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11725 /// Called on well-formed '\#pragma omp distribute simd' after
11726 /// parsing of the associated statement.
11728 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11729 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11730 /// Called on well-formed '\#pragma omp target parallel for simd' after
11731 /// parsing of the associated statement.
11733 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11734 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11735 /// Called on well-formed '\#pragma omp target simd' after parsing of
11736 /// the associated statement.
11739 SourceLocation StartLoc, SourceLocation EndLoc,
11740 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11741 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
11742 /// the associated statement.
11744 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11745 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11746 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
11747 /// of the associated statement.
11749 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11750 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11751 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
11752 /// after parsing of the associated statement.
11754 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11755 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11756 /// Called on well-formed '\#pragma omp teams distribute parallel for'
11757 /// after parsing of the associated statement.
11759 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11760 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11761 /// Called on well-formed '\#pragma omp target teams' after parsing of the
11762 /// associated statement.
11764 Stmt *AStmt,
11765 SourceLocation StartLoc,
11766 SourceLocation EndLoc);
11767 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
11768 /// of the associated statement.
11770 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11771 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11772 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
11773 /// after parsing of the associated statement.
11775 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11776 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11777 /// Called on well-formed '\#pragma omp target teams distribute parallel for
11778 /// simd' after parsing of the associated statement.
11780 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11781 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11782 /// Called on well-formed '\#pragma omp target teams distribute simd' after
11783 /// parsing of the associated statement.
11785 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11786 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11787 /// Called on well-formed '\#pragma omp interop'.
11789 SourceLocation StartLoc,
11790 SourceLocation EndLoc);
11791 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
11792 // /associated statement.
11794 Stmt *AStmt, SourceLocation StartLoc,
11795 SourceLocation EndLoc);
11796 /// Called on well-formed '\#pragma omp masked' after parsing of the
11797 // /associated statement.
11799 Stmt *AStmt, SourceLocation StartLoc,
11800 SourceLocation EndLoc);
11801
11802 /// Called on well-formed '\#pragma omp loop' after parsing of the
11803 /// associated statement.
11805 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11806 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11807
11808 /// Checks correctness of linear modifiers.
11810 SourceLocation LinLoc);
11811 /// Checks that the specified declaration matches requirements for the linear
11812 /// decls.
11815 bool IsDeclareSimd = false);
11816
11817 /// Called on well-formed '\#pragma omp declare simd' after parsing of
11818 /// the associated method/function.
11820 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
11821 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
11822 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
11823 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
11824
11825 /// Checks '\#pragma omp declare variant' variant function and original
11826 /// functions after parsing of the associated method/function.
11827 /// \param DG Function declaration to which declare variant directive is
11828 /// applied to.
11829 /// \param VariantRef Expression that references the variant function, which
11830 /// must be used instead of the original one, specified in \p DG.
11831 /// \param TI The trait info object representing the match clause.
11832 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
11833 /// in checking.
11834 /// \returns std::nullopt, if the function/variant function are not compatible
11835 /// with the pragma, pair of original function/variant ref expression
11836 /// otherwise.
11837 std::optional<std::pair<FunctionDecl *, Expr *>>
11839 OMPTraitInfo &TI, unsigned NumAppendArgs,
11840 SourceRange SR);
11841
11842 /// Called on well-formed '\#pragma omp declare variant' after parsing of
11843 /// the associated method/function.
11844 /// \param FD Function declaration to which declare variant directive is
11845 /// applied to.
11846 /// \param VariantRef Expression that references the variant function, which
11847 /// must be used instead of the original one, specified in \p DG.
11848 /// \param TI The context traits associated with the function variant.
11849 /// \param AdjustArgsNothing The list of 'nothing' arguments.
11850 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
11851 /// \param AppendArgs The list of 'append_args' arguments.
11852 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
11853 /// \param AppendArgsLoc The Location of an 'append_args' clause.
11854 /// \param SR The SourceRange of the 'declare variant' directive.
11856 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
11857 ArrayRef<Expr *> AdjustArgsNothing,
11858 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
11859 ArrayRef<OMPInteropInfo> AppendArgs, SourceLocation AdjustArgsLoc,
11860 SourceLocation AppendArgsLoc, SourceRange SR);
11861
11863 Expr *Expr,
11864 SourceLocation StartLoc,
11865 SourceLocation LParenLoc,
11866 SourceLocation EndLoc);
11867 /// Called on well-formed 'allocator' clause.
11869 SourceLocation StartLoc,
11870 SourceLocation LParenLoc,
11871 SourceLocation EndLoc);
11872 /// Called on well-formed 'if' clause.
11874 Expr *Condition, SourceLocation StartLoc,
11875 SourceLocation LParenLoc,
11876 SourceLocation NameModifierLoc,
11877 SourceLocation ColonLoc,
11878 SourceLocation EndLoc);
11879 /// Called on well-formed 'final' clause.
11881 SourceLocation LParenLoc,
11882 SourceLocation EndLoc);
11883 /// Called on well-formed 'num_threads' clause.
11885 SourceLocation StartLoc,
11886 SourceLocation LParenLoc,
11887 SourceLocation EndLoc);
11888 /// Called on well-formed 'align' clause.
11890 SourceLocation LParenLoc,
11891 SourceLocation EndLoc);
11892 /// Called on well-formed 'safelen' clause.
11894 SourceLocation StartLoc,
11895 SourceLocation LParenLoc,
11896 SourceLocation EndLoc);
11897 /// Called on well-formed 'simdlen' clause.
11899 SourceLocation LParenLoc,
11900 SourceLocation EndLoc);
11901 /// Called on well-form 'sizes' clause.
11903 SourceLocation StartLoc,
11904 SourceLocation LParenLoc,
11905 SourceLocation EndLoc);
11906 /// Called on well-form 'full' clauses.
11908 SourceLocation EndLoc);
11909 /// Called on well-form 'partial' clauses.
11911 SourceLocation LParenLoc,
11912 SourceLocation EndLoc);
11913 /// Called on well-formed 'collapse' clause.
11915 SourceLocation StartLoc,
11916 SourceLocation LParenLoc,
11917 SourceLocation EndLoc);
11918 /// Called on well-formed 'ordered' clause.
11919 OMPClause *
11921 SourceLocation LParenLoc = SourceLocation(),
11922 Expr *NumForLoops = nullptr);
11923 /// Called on well-formed 'grainsize' clause.
11925 Expr *Size, SourceLocation StartLoc,
11926 SourceLocation LParenLoc,
11927 SourceLocation ModifierLoc,
11928 SourceLocation EndLoc);
11929 /// Called on well-formed 'num_tasks' clause.
11931 Expr *NumTasks, SourceLocation StartLoc,
11932 SourceLocation LParenLoc,
11933 SourceLocation ModifierLoc,
11934 SourceLocation EndLoc);
11935 /// Called on well-formed 'hint' clause.
11937 SourceLocation LParenLoc,
11938 SourceLocation EndLoc);
11939 /// Called on well-formed 'detach' clause.
11941 SourceLocation LParenLoc,
11942 SourceLocation EndLoc);
11943
11945 unsigned Argument,
11946 SourceLocation ArgumentLoc,
11947 SourceLocation StartLoc,
11948 SourceLocation LParenLoc,
11949 SourceLocation EndLoc);
11950 /// Called on well-formed 'when' clause.
11952 SourceLocation LParenLoc,
11953 SourceLocation EndLoc);
11954 /// Called on well-formed 'default' clause.
11955 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
11956 SourceLocation KindLoc,
11957 SourceLocation StartLoc,
11958 SourceLocation LParenLoc,
11959 SourceLocation EndLoc);
11960 /// Called on well-formed 'proc_bind' clause.
11961 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
11962 SourceLocation KindLoc,
11963 SourceLocation StartLoc,
11964 SourceLocation LParenLoc,
11965 SourceLocation EndLoc);
11966 /// Called on well-formed 'order' clause.
11969 SourceLocation StartLoc,
11970 SourceLocation LParenLoc,
11971 SourceLocation MLoc, SourceLocation KindLoc,
11972 SourceLocation EndLoc);
11973 /// Called on well-formed 'update' clause.
11975 SourceLocation KindLoc,
11976 SourceLocation StartLoc,
11977 SourceLocation LParenLoc,
11978 SourceLocation EndLoc);
11979
11981 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
11982 SourceLocation StartLoc, SourceLocation LParenLoc,
11983 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
11984 SourceLocation EndLoc);
11985 /// Called on well-formed 'schedule' clause.
11988 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
11989 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
11990 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
11991
11993 SourceLocation EndLoc);
11994 /// Called on well-formed 'nowait' clause.
11996 SourceLocation EndLoc);
11997 /// Called on well-formed 'untied' clause.
11999 SourceLocation EndLoc);
12000 /// Called on well-formed 'mergeable' clause.
12002 SourceLocation EndLoc);
12003 /// Called on well-formed 'read' clause.
12005 SourceLocation EndLoc);
12006 /// Called on well-formed 'write' clause.
12008 SourceLocation EndLoc);
12009 /// Called on well-formed 'update' clause.
12011 SourceLocation EndLoc);
12012 /// Called on well-formed 'capture' clause.
12014 SourceLocation EndLoc);
12015 /// Called on well-formed 'compare' clause.
12017 SourceLocation EndLoc);
12018 /// Called on well-formed 'seq_cst' clause.
12020 SourceLocation EndLoc);
12021 /// Called on well-formed 'acq_rel' clause.
12023 SourceLocation EndLoc);
12024 /// Called on well-formed 'acquire' clause.
12026 SourceLocation EndLoc);
12027 /// Called on well-formed 'release' clause.
12029 SourceLocation EndLoc);
12030 /// Called on well-formed 'relaxed' clause.
12032 SourceLocation EndLoc);
12033
12034 /// Called on well-formed 'init' clause.
12035 OMPClause *
12036 ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo,
12037 SourceLocation StartLoc, SourceLocation LParenLoc,
12038 SourceLocation VarLoc, SourceLocation EndLoc);
12039
12040 /// Called on well-formed 'use' clause.
12041 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
12042 SourceLocation LParenLoc,
12043 SourceLocation VarLoc, SourceLocation EndLoc);
12044
12045 /// Called on well-formed 'destroy' clause.
12047 SourceLocation LParenLoc,
12048 SourceLocation VarLoc,
12049 SourceLocation EndLoc);
12050 /// Called on well-formed 'novariants' clause.
12052 SourceLocation StartLoc,
12053 SourceLocation LParenLoc,
12054 SourceLocation EndLoc);
12055 /// Called on well-formed 'nocontext' clause.
12057 SourceLocation StartLoc,
12058 SourceLocation LParenLoc,
12059 SourceLocation EndLoc);
12060 /// Called on well-formed 'filter' clause.
12062 SourceLocation LParenLoc,
12063 SourceLocation EndLoc);
12064 /// Called on well-formed 'threads' clause.
12066 SourceLocation EndLoc);
12067 /// Called on well-formed 'simd' clause.
12069 SourceLocation EndLoc);
12070 /// Called on well-formed 'nogroup' clause.
12072 SourceLocation EndLoc);
12073 /// Called on well-formed 'unified_address' clause.
12075 SourceLocation EndLoc);
12076
12077 /// Called on well-formed 'unified_address' clause.
12079 SourceLocation EndLoc);
12080
12081 /// Called on well-formed 'reverse_offload' clause.
12083 SourceLocation EndLoc);
12084
12085 /// Called on well-formed 'dynamic_allocators' clause.
12087 SourceLocation EndLoc);
12088
12089 /// Called on well-formed 'atomic_default_mem_order' clause.
12092 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
12093
12094 /// Called on well-formed 'at' clause.
12096 SourceLocation KindLoc,
12097 SourceLocation StartLoc,
12098 SourceLocation LParenLoc,
12099 SourceLocation EndLoc);
12100
12101 /// Called on well-formed 'severity' clause.
12103 SourceLocation KindLoc,
12104 SourceLocation StartLoc,
12105 SourceLocation LParenLoc,
12106 SourceLocation EndLoc);
12107
12108 /// Called on well-formed 'message' clause.
12109 /// passing string for message.
12111 SourceLocation LParenLoc,
12112 SourceLocation EndLoc);
12113
12114 /// Data used for processing a list of variables in OpenMP clauses.
12135
12137 ArrayRef<Expr *> Vars,
12138 const OMPVarListLocTy &Locs,
12140 /// Called on well-formed 'inclusive' clause.
12142 SourceLocation StartLoc,
12143 SourceLocation LParenLoc,
12144 SourceLocation EndLoc);
12145 /// Called on well-formed 'exclusive' clause.
12147 SourceLocation StartLoc,
12148 SourceLocation LParenLoc,
12149 SourceLocation EndLoc);
12150 /// Called on well-formed 'allocate' clause.
12151 OMPClause *
12153 SourceLocation StartLoc, SourceLocation ColonLoc,
12154 SourceLocation LParenLoc, SourceLocation EndLoc);
12155 /// Called on well-formed 'private' clause.
12157 SourceLocation StartLoc,
12158 SourceLocation LParenLoc,
12159 SourceLocation EndLoc);
12160 /// Called on well-formed 'firstprivate' clause.
12162 SourceLocation StartLoc,
12163 SourceLocation LParenLoc,
12164 SourceLocation EndLoc);
12165 /// Called on well-formed 'lastprivate' clause.
12168 SourceLocation LPKindLoc, SourceLocation ColonLoc,
12169 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
12170 /// Called on well-formed 'shared' clause.
12172 SourceLocation StartLoc,
12173 SourceLocation LParenLoc,
12174 SourceLocation EndLoc);
12175 /// Called on well-formed 'reduction' clause.
12178 SourceLocation StartLoc, SourceLocation LParenLoc,
12179 SourceLocation ModifierLoc, SourceLocation ColonLoc,
12180 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
12181 const DeclarationNameInfo &ReductionId,
12182 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
12183 /// Called on well-formed 'task_reduction' clause.
12185 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
12186 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
12187 CXXScopeSpec &ReductionIdScopeSpec,
12188 const DeclarationNameInfo &ReductionId,
12189 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
12190 /// Called on well-formed 'in_reduction' clause.
12192 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
12193 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
12194 CXXScopeSpec &ReductionIdScopeSpec,
12195 const DeclarationNameInfo &ReductionId,
12196 ArrayRef<Expr *> UnresolvedReductions = std::nullopt);
12197 /// Called on well-formed 'linear' clause.
12198 OMPClause *
12200 SourceLocation StartLoc, SourceLocation LParenLoc,
12201 OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
12202 SourceLocation ColonLoc, SourceLocation EndLoc);
12203 /// Called on well-formed 'aligned' clause.
12205 Expr *Alignment,
12206 SourceLocation StartLoc,
12207 SourceLocation LParenLoc,
12208 SourceLocation ColonLoc,
12209 SourceLocation EndLoc);
12210 /// Called on well-formed 'copyin' clause.
12212 SourceLocation StartLoc,
12213 SourceLocation LParenLoc,
12214 SourceLocation EndLoc);
12215 /// Called on well-formed 'copyprivate' clause.
12217 SourceLocation StartLoc,
12218 SourceLocation LParenLoc,
12219 SourceLocation EndLoc);
12220 /// Called on well-formed 'flush' pseudo clause.
12222 SourceLocation StartLoc,
12223 SourceLocation LParenLoc,
12224 SourceLocation EndLoc);
12225 /// Called on well-formed 'depobj' pseudo clause.
12227 SourceLocation LParenLoc,
12228 SourceLocation EndLoc);
12229 /// Called on well-formed 'depend' clause.
12231 Expr *DepModifier,
12232 ArrayRef<Expr *> VarList,
12233 SourceLocation StartLoc,
12234 SourceLocation LParenLoc,
12235 SourceLocation EndLoc);
12236 /// Called on well-formed 'device' clause.
12238 Expr *Device, SourceLocation StartLoc,
12239 SourceLocation LParenLoc,
12240 SourceLocation ModifierLoc,
12241 SourceLocation EndLoc);
12242 /// Called on well-formed 'map' clause.
12244 Expr *IteratorModifier, ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
12245 ArrayRef<SourceLocation> MapTypeModifiersLoc,
12246 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
12247 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
12248 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
12249 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
12250 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
12251 /// Called on well-formed 'num_teams' clause.
12253 SourceLocation LParenLoc,
12254 SourceLocation EndLoc);
12255 /// Called on well-formed 'thread_limit' clause.
12257 SourceLocation StartLoc,
12258 SourceLocation LParenLoc,
12259 SourceLocation EndLoc);
12260 /// Called on well-formed 'priority' clause.
12262 SourceLocation LParenLoc,
12263 SourceLocation EndLoc);
12264 /// Called on well-formed 'dist_schedule' clause.
12266 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
12267 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
12268 SourceLocation CommaLoc, SourceLocation EndLoc);
12269 /// Called on well-formed 'defaultmap' clause.
12272 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
12273 SourceLocation KindLoc, SourceLocation EndLoc);
12274 /// Called on well-formed 'to' clause.
12275 OMPClause *
12277 ArrayRef<SourceLocation> MotionModifiersLoc,
12278 CXXScopeSpec &MapperIdScopeSpec,
12279 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
12280 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
12281 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
12282 /// Called on well-formed 'from' clause.
12283 OMPClause *
12285 ArrayRef<SourceLocation> MotionModifiersLoc,
12286 CXXScopeSpec &MapperIdScopeSpec,
12287 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
12288 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
12289 ArrayRef<Expr *> UnresolvedMappers = std::nullopt);
12290 /// Called on well-formed 'use_device_ptr' clause.
12292 const OMPVarListLocTy &Locs);
12293 /// Called on well-formed 'use_device_addr' clause.
12295 const OMPVarListLocTy &Locs);
12296 /// Called on well-formed 'is_device_ptr' clause.
12298 const OMPVarListLocTy &Locs);
12299 /// Called on well-formed 'has_device_addr' clause.
12301 const OMPVarListLocTy &Locs);
12302 /// Called on well-formed 'nontemporal' clause.
12304 SourceLocation StartLoc,
12305 SourceLocation LParenLoc,
12306 SourceLocation EndLoc);
12307
12308 /// Data for list of allocators.
12310 /// Allocator.
12311 Expr *Allocator = nullptr;
12312 /// Allocator traits.
12314 /// Locations of '(' and ')' symbols.
12316 };
12317 /// Called on well-formed 'uses_allocators' clause.
12319 SourceLocation LParenLoc,
12320 SourceLocation EndLoc,
12322 /// Called on well-formed 'affinity' clause.
12324 SourceLocation LParenLoc,
12325 SourceLocation ColonLoc,
12326 SourceLocation EndLoc, Expr *Modifier,
12327 ArrayRef<Expr *> Locators);
12328 /// Called on a well-formed 'bind' clause.
12330 SourceLocation KindLoc,
12331 SourceLocation StartLoc,
12332 SourceLocation LParenLoc,
12333 SourceLocation EndLoc);
12334
12335 /// Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
12337 SourceLocation LParenLoc,
12338 SourceLocation EndLoc);
12339
12340 /// Called on well-formed 'doacross' clause.
12341 OMPClause *
12343 SourceLocation DepLoc, SourceLocation ColonLoc,
12344 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
12345 SourceLocation LParenLoc, SourceLocation EndLoc);
12346
12347 /// The kind of conversion being performed.
12349 /// An implicit conversion.
12351 /// A C-style cast.
12353 /// A functional-style cast.
12355 /// A cast other than a C-style cast.
12357 /// A conversion for an operand of a builtin overloaded operator.
12360
12362 return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast ||
12363 CCK == CCK_OtherCast;
12364 }
12365
12366 /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
12367 /// cast. If there is already an implicit cast, merge into the existing one.
12368 /// If isLvalue, the result of the cast is an lvalue.
12372 const CXXCastPath *BasePath = nullptr,
12374
12375 /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
12376 /// to the conversion from scalar type ScalarTy to the Boolean type.
12378
12379 /// IgnoredValueConversions - Given that an expression's result is
12380 /// syntactically ignored, perform any conversions that are
12381 /// required.
12383
12384 // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
12385 // functions and arrays to their respective pointers (C99 6.3.2.1).
12387
12388 /// CallExprUnaryConversions - a special case of an unary conversion
12389 /// performed on a function designator of a call expression.
12391
12392 // DefaultFunctionArrayConversion - converts functions and arrays
12393 // to their respective pointers (C99 6.3.2.1).
12395
12396 // DefaultFunctionArrayLvalueConversion - converts functions and
12397 // arrays to their respective pointers and performs the
12398 // lvalue-to-rvalue conversion.
12400 bool Diagnose = true);
12401
12402 // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
12403 // the operand. This function is a no-op if the operand has a function type
12404 // or an array type.
12406
12407 // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
12408 // do not have a prototype. Integer promotions are performed on each
12409 // argument, and arguments that have type float are promoted to double.
12411
12412 /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
12413 /// it as an xvalue. In C++98, the result will still be a prvalue, because
12414 /// we don't have xvalues there.
12416
12417 // Used for emitting the right warning by DefaultVariadicArgumentPromotion
12425
12427 const FunctionProtoType *Proto,
12428 Expr *Fn);
12429
12430 // Used for determining in which context a type is allowed to be passed to a
12431 // vararg function.
12439
12440 // Determines which VarArgKind fits an expression.
12442
12443 /// Check to see if the given expression is a valid argument to a variadic
12444 /// function, issuing a diagnostic if not.
12445 void checkVariadicArgument(const Expr *E, VariadicCallType CT);
12446
12447 /// Check whether the given statement can have musttail applied to it,
12448 /// issuing a diagnostic and returning false if not. In the success case,
12449 /// the statement is rewritten to remove implicit nodes from the return
12450 /// value.
12451 bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA);
12452
12453private:
12454 /// Check whether the given statement can have musttail applied to it,
12455 /// issuing a diagnostic and returning false if not.
12456 bool checkMustTailAttr(const Stmt *St, const Attr &MTA);
12457
12458public:
12459 /// Check to see if a given expression could have '.c_str()' called on it.
12460 bool hasCStrMethod(const Expr *E);
12461
12462 /// GatherArgumentsForCall - Collector argument expressions for various
12463 /// form of call prototypes.
12465 const FunctionProtoType *Proto,
12466 unsigned FirstParam, ArrayRef<Expr *> Args,
12467 SmallVectorImpl<Expr *> &AllArgs,
12469 bool AllowExplicit = false,
12470 bool IsListInitialization = false);
12471
12472 // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
12473 // will create a runtime trap if the resulting type is not a POD type.
12475 FunctionDecl *FDecl);
12476
12477 /// Context in which we're performing a usual arithmetic conversion.
12479 /// An arithmetic operation.
12481 /// A bitwise operation.
12483 /// A comparison.
12485 /// A conditional (?:) operator.
12487 /// A compound assignment expression.
12489 };
12490
12491 // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
12492 // operands and then handles various conversions that are common to binary
12493 // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
12494 // routine returns the first non-arithmetic type found. The client is
12495 // responsible for emitting appropriate error diagnostics.
12497 SourceLocation Loc, ArithConvKind ACK);
12498
12499 /// AssignConvertType - All of the 'assignment' semantic checks return this
12500 /// enum to indicate whether the assignment was allowed. These checks are
12501 /// done for simple assignments, as well as initialization, return from
12502 /// function, argument passing, etc. The query is phrased in terms of a
12503 /// source and destination type.
12505 /// Compatible - the types are compatible according to the standard.
12507
12508 /// PointerToInt - The assignment converts a pointer to an int, which we
12509 /// accept as an extension.
12511
12512 /// IntToPointer - The assignment converts an int to a pointer, which we
12513 /// accept as an extension.
12515
12516 /// FunctionVoidPointer - The assignment is between a function pointer and
12517 /// void*, which the standard doesn't allow, but we accept as an extension.
12519
12520 /// IncompatiblePointer - The assignment is between two pointers types that
12521 /// are not compatible, but we accept them as an extension.
12523
12524 /// IncompatibleFunctionPointer - The assignment is between two function
12525 /// pointers types that are not compatible, but we accept them as an
12526 /// extension.
12528
12529 /// IncompatibleFunctionPointerStrict - The assignment is between two
12530 /// function pointer types that are not identical, but are compatible,
12531 /// unless compiled with -fsanitize=cfi, in which case the type mismatch
12532 /// may trip an indirect call runtime check.
12534
12535 /// IncompatiblePointerSign - The assignment is between two pointers types
12536 /// which point to integers which have a different sign, but are otherwise
12537 /// identical. This is a subset of the above, but broken out because it's by
12538 /// far the most common case of incompatible pointers.
12540
12541 /// CompatiblePointerDiscardsQualifiers - The assignment discards
12542 /// c/v/r qualifiers, which we accept as an extension.
12544
12545 /// IncompatiblePointerDiscardsQualifiers - The assignment
12546 /// discards qualifiers that we don't permit to be discarded,
12547 /// like address spaces.
12549
12550 /// IncompatibleNestedPointerAddressSpaceMismatch - The assignment
12551 /// changes address spaces in nested pointer types which is not allowed.
12552 /// For instance, converting __private int ** to __generic int ** is
12553 /// illegal even though __private could be converted to __generic.
12555
12556 /// IncompatibleNestedPointerQualifiers - The assignment is between two
12557 /// nested pointer types, and the qualifiers other than the first two
12558 /// levels differ e.g. char ** -> const char **, but we accept them as an
12559 /// extension.
12561
12562 /// IncompatibleVectors - The assignment is between two vector types that
12563 /// have the same size, which we accept as an extension.
12565
12566 /// IntToBlockPointer - The assignment converts an int to a block
12567 /// pointer. We disallow this.
12569
12570 /// IncompatibleBlockPointer - The assignment is between two block
12571 /// pointers types that are not compatible.
12573
12574 /// IncompatibleObjCQualifiedId - The assignment is between a qualified
12575 /// id type and something else (that is incompatible with it). For example,
12576 /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
12578
12579 /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
12580 /// object with __weak qualifier.
12582
12583 /// Incompatible - We reject this conversion outright, it is invalid to
12584 /// represent it in the AST.
12587
12588 /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
12589 /// assignment conversion type specified by ConvTy. This returns true if the
12590 /// conversion was invalid or false if the conversion was accepted.
12592 SourceLocation Loc,
12593 QualType DstType, QualType SrcType,
12594 Expr *SrcExpr, AssignmentAction Action,
12595 bool *Complained = nullptr);
12596
12597 /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
12598 /// enum. If AllowMask is true, then we also allow the complement of a valid
12599 /// value, to be used as a mask.
12600 bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
12601 bool AllowMask) const;
12602
12603 /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
12604 /// integer not in the range of enum values.
12605 void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
12606 Expr *SrcExpr);
12607
12608 /// CheckAssignmentConstraints - Perform type checking for assignment,
12609 /// argument passing, variable initialization, and function return values.
12610 /// C99 6.5.16.
12612 QualType LHSType,
12613 QualType RHSType);
12614
12615 /// Check assignment constraints and optionally prepare for a conversion of
12616 /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
12617 /// is true.
12619 ExprResult &RHS,
12620 CastKind &Kind,
12621 bool ConvertRHS = true);
12622
12623 /// Check assignment constraints for an assignment of RHS to LHSType.
12624 ///
12625 /// \param LHSType The destination type for the assignment.
12626 /// \param RHS The source expression for the assignment.
12627 /// \param Diagnose If \c true, diagnostics may be produced when checking
12628 /// for assignability. If a diagnostic is produced, \p RHS will be
12629 /// set to ExprError(). Note that this function may still return
12630 /// without producing a diagnostic, even for an invalid assignment.
12631 /// \param DiagnoseCFAudited If \c true, the target is a function parameter
12632 /// in an audited Core Foundation API and does not need to be checked
12633 /// for ARC retain issues.
12634 /// \param ConvertRHS If \c true, \p RHS will be updated to model the
12635 /// conversions necessary to perform the assignment. If \c false,
12636 /// \p Diagnose must also be \c false.
12638 QualType LHSType, ExprResult &RHS, bool Diagnose = true,
12639 bool DiagnoseCFAudited = false, bool ConvertRHS = true);
12640
12641 // If the lhs type is a transparent union, check whether we
12642 // can initialize the transparent union with the given expression.
12644 ExprResult &RHS);
12645
12647
12648 bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
12649
12651 AssignmentAction Action,
12652 bool AllowExplicit = false);
12654 const ImplicitConversionSequence& ICS,
12655 AssignmentAction Action,
12659 const StandardConversionSequence& SCS,
12660 AssignmentAction Action,
12662
12666
12667 /// the following "Check" methods will return a valid/converted QualType
12668 /// or a null QualType (indicating an error diagnostic was issued).
12669
12670 /// type checking binary operators (subroutines of CreateBuiltinBinOp).
12672 ExprResult &RHS);
12674 ExprResult &RHS);
12676 ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
12677 SourceLocation OpLoc, bool isIndirect);
12679 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
12680 bool IsDivide);
12681 QualType CheckRemainderOperands( // C99 6.5.5
12682 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12683 bool IsCompAssign = false);
12684 QualType CheckAdditionOperands( // C99 6.5.6
12685 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12686 BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
12688 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12689 QualType* CompLHSTy = nullptr);
12690 QualType CheckShiftOperands( // C99 6.5.7
12691 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12692 BinaryOperatorKind Opc, bool IsCompAssign = false);
12694 QualType CheckCompareOperands( // C99 6.5.8/9
12695 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12696 BinaryOperatorKind Opc);
12697 QualType CheckBitwiseOperands( // C99 6.5.[10...12]
12698 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12699 BinaryOperatorKind Opc);
12700 QualType CheckLogicalOperands( // C99 6.5.[13,14]
12701 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12702 BinaryOperatorKind Opc);
12703 // CheckAssignmentOperands is used for both simple and compound assignment.
12704 // For simple assignment, pass both expressions and a null converted type.
12705 // For compound assignment, pass both expressions and the converted type.
12706 QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
12707 Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType,
12708 BinaryOperatorKind Opc);
12709
12711 UnaryOperatorKind Opcode, Expr *Op);
12713 BinaryOperatorKind Opcode,
12714 Expr *LHS, Expr *RHS);
12717
12718 QualType CheckConditionalOperands( // C99 6.5.15
12719 ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
12720 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
12722 ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
12723 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
12725 ExprResult &RHS,
12726 SourceLocation QuestionLoc);
12727
12729 ExprResult &LHS, ExprResult &RHS,
12730 SourceLocation QuestionLoc);
12732 bool ConvertArgs = true);
12734 ExprResult &E1, ExprResult &E2,
12735 bool ConvertArgs = true) {
12736 Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
12737 QualType Composite =
12738 FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
12739 E1 = E1Tmp;
12740 E2 = E2Tmp;
12741 return Composite;
12742 }
12743
12745 SourceLocation QuestionLoc);
12746
12747 bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
12748 SourceLocation QuestionLoc);
12749
12752 bool IsEqual, SourceRange Range);
12753
12754 /// type checking for vector binary operators.
12756 SourceLocation Loc, bool IsCompAssign,
12757 bool AllowBothBool, bool AllowBoolConversion,
12758 bool AllowBoolOperation, bool ReportInvalid);
12762 SourceLocation Loc,
12763 BinaryOperatorKind Opc);
12765 SourceLocation Loc,
12766 BinaryOperatorKind Opc);
12768 SourceLocation Loc);
12769
12770 // type checking for sizeless vector binary operators.
12772 SourceLocation Loc, bool IsCompAssign,
12773 ArithConvKind OperationKind);
12774
12775 /// Type checking for matrix binary operators.
12777 SourceLocation Loc,
12778 bool IsCompAssign);
12780 SourceLocation Loc, bool IsCompAssign);
12781
12782 bool isValidSveBitcast(QualType srcType, QualType destType);
12783 bool isValidRVVBitcast(QualType srcType, QualType destType);
12784
12786
12787 bool areVectorTypesSameSize(QualType srcType, QualType destType);
12788 bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
12789 bool isLaxVectorConversion(QualType srcType, QualType destType);
12790 bool anyAltivecTypes(QualType srcType, QualType destType);
12791
12792 /// type checking declaration initializers (C99 6.7.8)
12794
12795 // type checking C++ declaration initializers (C++ [dcl.init]).
12796
12797 /// ReferenceCompareResult - Expresses the result of comparing two
12798 /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
12799 /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
12801 /// Ref_Incompatible - The two types are incompatible, so direct
12802 /// reference binding is not possible.
12804 /// Ref_Related - The two types are reference-related, which means
12805 /// that their unqualified forms (T1 and T2) are either the same
12806 /// or T1 is a base class of T2.
12808 /// Ref_Compatible - The two types are reference-compatible.
12811
12812 // Fake up a scoped enumeration that still contextually converts to bool.
12814 /// The conversions that would be performed on an lvalue of type T2 when
12815 /// binding a reference of type T1 to it, as determined when evaluating
12816 /// whether T1 is reference-compatible with T2.
12820 Function = 0x4,
12822 ObjC = 0x10,
12824
12825 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
12826 };
12827 };
12829
12832 ReferenceConversions *Conv = nullptr);
12833
12836 ExprValueKind &VK, CXXCastPath &Path);
12837
12838 /// Force an expression with unknown-type to an expression of the
12839 /// given type.
12841
12842 /// Type-check an expression that's being passed to an
12843 /// __unknown_anytype parameter.
12845 Expr *result, QualType &paramType);
12846
12847 // CheckMatrixCast - Check type constraints for matrix casts.
12848 // We allow casting between matrixes of the same dimensions i.e. when they
12849 // have the same number of rows and column. Returns true if the cast is
12850 // invalid.
12851 bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy,
12852 CastKind &Kind);
12853
12854 // CheckVectorCast - check type constraints for vectors.
12855 // Since vectors are an extension, there are no C standard reference for this.
12856 // We allow casting between vectors and integer datatypes of the same size.
12857 // returns true if the cast is invalid
12858 bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
12859 CastKind &Kind);
12860
12861 /// Prepare `SplattedExpr` for a vector splat operation, adding
12862 /// implicit casts if necessary.
12863 ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
12864
12865 // CheckExtVectorCast - check type constraints for extended vectors.
12866 // Since vectors are an extension, there are no C standard reference for this.
12867 // We allow casting between vectors and integer datatypes of the same size,
12868 // or vectors and the element type of that vector.
12869 // returns the cast expr
12871 CastKind &Kind);
12872
12874 SourceLocation LParenLoc,
12875 Expr *CastExpr,
12876 SourceLocation RParenLoc);
12877
12879
12880 /// Checks for invalid conversions and casts between
12881 /// retainable pointers and other pointer kinds for ARC and Weak.
12883 QualType castType, Expr *&op,
12885 bool Diagnose = true,
12886 bool DiagnoseCFAudited = false,
12887 BinaryOperatorKind Opc = BO_PtrMemD
12888 );
12889
12892
12894 QualType ExprType);
12895
12896 /// checkRetainCycles - Check whether an Objective-C message send
12897 /// might create an obvious retain cycle.
12899 void checkRetainCycles(Expr *receiver, Expr *argument);
12900 void checkRetainCycles(VarDecl *Var, Expr *Init);
12901
12902 /// checkUnsafeAssigns - Check whether +1 expr is being assigned
12903 /// to weak/__unsafe_unretained type.
12904 bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
12905
12906 /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
12907 /// to weak/__unsafe_unretained expression.
12908 void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
12909
12910 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
12911 /// \param Method - May be null.
12912 /// \param [out] ReturnType - The return type of the send.
12913 /// \return true iff there were any incompatible types.
12914 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
12915 MultiExprArg Args, Selector Sel,
12916 ArrayRef<SourceLocation> SelectorLocs,
12917 ObjCMethodDecl *Method, bool isClassMessage,
12918 bool isSuperMessage, SourceLocation lbrac,
12919 SourceLocation rbrac, SourceRange RecRange,
12920 QualType &ReturnType, ExprValueKind &VK);
12921
12922 /// Determine the result of a message send expression based on
12923 /// the type of the receiver, the method expected to receive the message,
12924 /// and the form of the message send.
12925 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
12926 ObjCMethodDecl *Method, bool isClassMessage,
12927 bool isSuperMessage);
12928
12929 /// If the given expression involves a message send to a method
12930 /// with a related result type, emit a note describing what happened.
12931 void EmitRelatedResultTypeNote(const Expr *E);
12932
12933 /// Given that we had incompatible pointer types in a return
12934 /// statement, check whether we're in a method with a related result
12935 /// type, and if so, emit a note describing what happened.
12937
12939 Decl *ConditionVar;
12940 FullExprArg Condition;
12941 bool Invalid;
12942 std::optional<bool> KnownValue;
12943
12944 friend class Sema;
12945 ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
12946 bool IsConstexpr)
12947 : ConditionVar(ConditionVar), Condition(Condition), Invalid(false) {
12948 if (IsConstexpr && Condition.get()) {
12949 if (std::optional<llvm::APSInt> Val =
12950 Condition.get()->getIntegerConstantExpr(S.Context)) {
12951 KnownValue = !!(*Val);
12952 }
12953 }
12954 }
12955 explicit ConditionResult(bool Invalid)
12956 : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
12957 KnownValue(std::nullopt) {}
12958
12959 public:
12961 bool isInvalid() const { return Invalid; }
12962 std::pair<VarDecl *, Expr *> get() const {
12963 return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
12964 Condition.get());
12965 }
12966 std::optional<bool> getKnownValue() const { return KnownValue; }
12967 };
12969
12970 enum class ConditionKind {
12971 Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
12972 ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
12973 Switch ///< An integral condition for a 'switch' statement.
12974 };
12976 return K == ConditionKind::Switch ? Context.IntTy : Context.BoolTy;
12977 }
12978
12979 ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr,
12980 ConditionKind CK, bool MissingOK = false);
12981
12982 ConditionResult ActOnConditionVariable(Decl *ConditionVar,
12983 SourceLocation StmtLoc,
12984 ConditionKind CK);
12985
12986 DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D);
12987
12988 ExprResult CheckConditionVariable(VarDecl *ConditionVar,
12989 SourceLocation StmtLoc,
12990 ConditionKind CK);
12991 ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond);
12992
12993 /// CheckBooleanCondition - Diagnose problems involving the use of
12994 /// the given expression as a boolean condition (e.g. in an if
12995 /// statement). Also performs the standard function and array
12996 /// decays, possibly changing the input variable.
12997 ///
12998 /// \param Loc - A location associated with the condition, e.g. the
12999 /// 'if' keyword.
13000 /// \return true iff there were any errors
13001 ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E,
13002 bool IsConstexpr = false);
13003
13004 /// ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression
13005 /// found in an explicit(bool) specifier.
13006 ExplicitSpecifier ActOnExplicitBoolSpecifier(Expr *E);
13007
13008 /// tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
13009 /// Returns true if the explicit specifier is now resolved.
13010 bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec);
13011
13012 /// DiagnoseAssignmentAsCondition - Given that an expression is
13013 /// being used as a boolean condition, warn if it's an assignment.
13014 void DiagnoseAssignmentAsCondition(Expr *E);
13015
13016 /// Redundant parentheses over an equality comparison can indicate
13017 /// that the user intended an assignment used as condition.
13018 void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE);
13019
13020 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
13021 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
13022
13023 /// Checks that the Objective-C declaration is declared in the global scope.
13024 /// Emits an error and marks the declaration as invalid if it's not declared
13025 /// in the global scope.
13026 bool CheckObjCDeclScope(Decl *D);
13027
13028 /// Abstract base class used for diagnosing integer constant
13029 /// expression violations.
13031 public:
13033
13034 VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) { }
13035
13036 virtual SemaDiagnosticBuilder
13037 diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T);
13039 SourceLocation Loc) = 0;
13040 virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc);
13042 };
13043
13048
13049 /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
13050 /// and reports the appropriate diagnostics. Returns false on success.
13051 /// Can optionally return the value of the expression.
13052 ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
13053 VerifyICEDiagnoser &Diagnoser,
13054 AllowFoldKind CanFold = NoFold);
13055 ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
13056 unsigned DiagID,
13057 AllowFoldKind CanFold = NoFold);
13058 ExprResult VerifyIntegerConstantExpression(Expr *E,
13059 llvm::APSInt *Result = nullptr,
13060 AllowFoldKind CanFold = NoFold);
13062 AllowFoldKind CanFold = NoFold) {
13063 return VerifyIntegerConstantExpression(E, nullptr, CanFold);
13064 }
13065
13066 /// VerifyBitField - verifies that a bit field expression is an ICE and has
13067 /// the correct width, and that the field type is valid.
13068 /// Returns false on success.
13069 ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName,
13070 QualType FieldTy, bool IsMsStruct, Expr *BitWidth);
13071
13072private:
13073 unsigned ForceCUDAHostDeviceDepth = 0;
13074
13075public:
13076 /// Increments our count of the number of times we've seen a pragma forcing
13077 /// functions to be __host__ __device__. So long as this count is greater
13078 /// than zero, all functions encountered will be __host__ __device__.
13079 void PushForceCUDAHostDevice();
13080
13081 /// Decrements our count of the number of times we've seen a pragma forcing
13082 /// functions to be __host__ __device__. Returns false if the count is 0
13083 /// before incrementing, so you can emit an error.
13084 bool PopForceCUDAHostDevice();
13085
13086 /// Diagnostics that are emitted only if we discover that the given function
13087 /// must be codegen'ed. Because handling these correctly adds overhead to
13088 /// compilation, this is currently only enabled for CUDA compilations.
13089 llvm::DenseMap<CanonicalDeclPtr<const FunctionDecl>,
13090 std::vector<PartialDiagnosticAt>>
13092
13093 /// A pair of a canonical FunctionDecl and a SourceLocation. When used as the
13094 /// key in a hashtable, both the FD and location are hashed.
13099
13100 /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
13101 /// (maybe deferred) "bad call" diagnostic. We use this to avoid emitting the
13102 /// same deferred diag twice.
13104
13105 /// An inverse call graph, mapping known-emitted functions to one of their
13106 /// known-emitted callers (plus the location of the call).
13107 ///
13108 /// Functions that we can tell a priori must be emitted aren't added to this
13109 /// map.
13110 llvm::DenseMap</* Callee = */ CanonicalDeclPtr<const FunctionDecl>,
13111 /* Caller = */ FunctionDeclAndLoc>
13113
13114 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13115 /// context is "used as device code".
13116 ///
13117 /// - If CurContext is a __host__ function, does not emit any diagnostics
13118 /// unless \p EmitOnBothSides is true.
13119 /// - If CurContext is a __device__ or __global__ function, emits the
13120 /// diagnostics immediately.
13121 /// - If CurContext is a __host__ __device__ function and we are compiling for
13122 /// the device, creates a diagnostic which is emitted if and when we realize
13123 /// that the function will be codegen'ed.
13124 ///
13125 /// Example usage:
13126 ///
13127 /// // Variable-length arrays are not allowed in CUDA device code.
13128 /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
13129 /// return ExprError();
13130 /// // Otherwise, continue parsing as normal.
13131 SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc,
13132 unsigned DiagID);
13133
13134 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13135 /// context is "used as host code".
13136 ///
13137 /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
13138 SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID);
13139
13140 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13141 /// context is "used as device code".
13142 ///
13143 /// - If CurContext is a `declare target` function or it is known that the
13144 /// function is emitted for the device, emits the diagnostics immediately.
13145 /// - If CurContext is a non-`declare target` function and we are compiling
13146 /// for the device, creates a diagnostic which is emitted if and when we
13147 /// realize that the function will be codegen'ed.
13148 ///
13149 /// Example usage:
13150 ///
13151 /// // Variable-length arrays are not allowed in NVPTX device code.
13152 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
13153 /// return ExprError();
13154 /// // Otherwise, continue parsing as normal.
13155 SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc,
13156 unsigned DiagID,
13157 const FunctionDecl *FD);
13158
13159 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13160 /// context is "used as host code".
13161 ///
13162 /// - If CurContext is a `declare target` function or it is known that the
13163 /// function is emitted for the host, emits the diagnostics immediately.
13164 /// - If CurContext is a non-host function, just ignore it.
13165 ///
13166 /// Example usage:
13167 ///
13168 /// // Variable-length arrays are not allowed in NVPTX device code.
13169 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
13170 /// return ExprError();
13171 /// // Otherwise, continue parsing as normal.
13172 SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc,
13173 unsigned DiagID,
13174 const FunctionDecl *FD);
13175
13176 SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID,
13177 const FunctionDecl *FD = nullptr);
13179 const PartialDiagnostic &PD,
13180 const FunctionDecl *FD = nullptr) {
13181 return targetDiag(Loc, PD.getDiagID(), FD) << PD;
13182 }
13183
13184 /// Check if the type is allowed to be used for the current target.
13185 void checkTypeSupport(QualType Ty, SourceLocation Loc,
13186 ValueDecl *D = nullptr);
13187
13195
13196 /// Determines whether the given function is a CUDA device/host/kernel/etc.
13197 /// function.
13198 ///
13199 /// Use this rather than examining the function's attributes yourself -- you
13200 /// will get it wrong. Returns CFT_Host if D is null.
13201 CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D,
13202 bool IgnoreImplicitHDAttr = false);
13203 CUDAFunctionTarget IdentifyCUDATarget(const ParsedAttributesView &Attrs);
13204
13206 CVT_Device, /// Emitted on device side with a shadow variable on host side
13207 CVT_Host, /// Emitted on host side only
13208 CVT_Both, /// Emitted on both sides with different addresses
13209 CVT_Unified, /// Emitted as a unified address, e.g. managed variables
13210 };
13211 /// Determines whether the given variable is emitted on host or device side.
13212 CUDAVariableTarget IdentifyCUDATarget(const VarDecl *D);
13213
13214 /// Gets the CUDA target for the current context.
13216 return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
13217 }
13218
13219 static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D);
13220
13221 // CUDA function call preference. Must be ordered numerically from
13222 // worst to best.
13224 CFP_Never, // Invalid caller/callee combination.
13225 CFP_WrongSide, // Calls from host-device to host or device
13226 // function that do not match current compilation
13227 // mode.
13228 CFP_HostDevice, // Any calls to host/device functions.
13229 CFP_SameSide, // Calls from host-device to host or device
13230 // function matching current compilation mode.
13231 CFP_Native, // host-to-host or device-to-device calls.
13232 };
13233
13234 /// Identifies relative preference of a given Caller/Callee
13235 /// combination, based on their host/device attributes.
13236 /// \param Caller function which needs address of \p Callee.
13237 /// nullptr in case of global context.
13238 /// \param Callee target function
13239 ///
13240 /// \returns preference value for particular Caller/Callee combination.
13241 CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller,
13242 const FunctionDecl *Callee);
13243
13244 /// Determines whether Caller may invoke Callee, based on their CUDA
13245 /// host/device attributes. Returns false if the call is not allowed.
13246 ///
13247 /// Note: Will return true for CFP_WrongSide calls. These may appear in
13248 /// semantically correct CUDA programs, but only if they're never codegen'ed.
13250 const FunctionDecl *Callee) {
13251 return IdentifyCUDAPreference(Caller, Callee) != CFP_Never;
13252 }
13253
13254 /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
13255 /// depending on FD and the current compilation settings.
13256 void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD,
13257 const LookupResult &Previous);
13258
13259 /// May add implicit CUDAConstantAttr attribute to VD, depending on VD
13260 /// and current compilation settings.
13261 void MaybeAddCUDAConstantAttr(VarDecl *VD);
13262
13263public:
13264 /// Check whether we're allowed to call Callee from the current context.
13265 ///
13266 /// - If the call is never allowed in a semantically-correct program
13267 /// (CFP_Never), emits an error and returns false.
13268 ///
13269 /// - If the call is allowed in semantically-correct programs, but only if
13270 /// it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
13271 /// be emitted if and when the caller is codegen'ed, and returns true.
13272 ///
13273 /// Will only create deferred diagnostics for a given SourceLocation once,
13274 /// so you can safely call this multiple times without generating duplicate
13275 /// deferred errors.
13276 ///
13277 /// - Otherwise, returns true without emitting any diagnostics.
13278 bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
13279
13280 void CUDACheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture);
13281
13282 /// Set __device__ or __host__ __device__ attributes on the given lambda
13283 /// operator() method.
13284 ///
13285 /// CUDA lambdas by default is host device function unless it has explicit
13286 /// host or device attribute.
13287 void CUDASetLambdaAttrs(CXXMethodDecl *Method);
13288
13289 /// Finds a function in \p Matches with highest calling priority
13290 /// from \p Caller context and erases all functions with lower
13291 /// calling priority.
13292 void EraseUnwantedCUDAMatches(
13293 const FunctionDecl *Caller,
13294 SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
13295
13296 /// Given a implicit special member, infer its CUDA target from the
13297 /// calls it needs to make to underlying base/field special members.
13298 /// \param ClassDecl the class for which the member is being created.
13299 /// \param CSM the kind of special member.
13300 /// \param MemberDecl the special member itself.
13301 /// \param ConstRHS true if this is a copy operation with a const object on
13302 /// its RHS.
13303 /// \param Diagnose true if this call should emit diagnostics.
13304 /// \return true if there was an error inferring.
13305 /// The result of this call is implicit CUDA target attribute(s) attached to
13306 /// the member declaration.
13307 bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
13308 CXXSpecialMember CSM,
13309 CXXMethodDecl *MemberDecl,
13310 bool ConstRHS,
13311 bool Diagnose);
13312
13313 /// \return true if \p CD can be considered empty according to CUDA
13314 /// (E.2.3.1 in CUDA 7.5 Programming guide).
13315 bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD);
13316 bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD);
13317
13318 // \brief Checks that initializers of \p Var satisfy CUDA restrictions. In
13319 // case of error emits appropriate diagnostic and invalidates \p Var.
13320 //
13321 // \details CUDA allows only empty constructors as initializers for global
13322 // variables (see E.2.3.1, CUDA 7.5). The same restriction also applies to all
13323 // __shared__ variables whether they are local or not (they all are implicitly
13324 // static in CUDA). One exception is that CUDA allows constant initializers
13325 // for __constant__ and __device__ variables.
13326 void checkAllowedCUDAInitializer(VarDecl *VD);
13327
13328 /// Check whether NewFD is a valid overload for CUDA. Emits
13329 /// diagnostics and invalidates NewFD if not.
13330 void checkCUDATargetOverload(FunctionDecl *NewFD,
13331 const LookupResult &Previous);
13332 /// Copies target attributes from the template TD to the function FD.
13333 void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD);
13334
13335 /// Returns the name of the launch configuration function. This is the name
13336 /// of the function that will be called to configure kernel call, with the
13337 /// parameters specified via <<<>>>.
13338 std::string getCudaConfigureFuncName() const;
13339
13340 /// \name Code completion
13341 //@{
13342 /// Describes the context in which code completion occurs.
13344 /// Code completion occurs at top-level or namespace context.
13346 /// Code completion occurs within a class, struct, or union.
13348 /// Code completion occurs within an Objective-C interface, protocol,
13349 /// or category.
13351 /// Code completion occurs within an Objective-C implementation or
13352 /// category implementation
13354 /// Code completion occurs within the list of instance variables
13355 /// in an Objective-C interface, protocol, category, or implementation.
13357 /// Code completion occurs following one or more template
13358 /// headers.
13360 /// Code completion occurs following one or more template
13361 /// headers within a class.
13363 /// Code completion occurs within an expression.
13365 /// Code completion occurs within a statement, which may
13366 /// also be an expression or a declaration.
13368 /// Code completion occurs at the beginning of the
13369 /// initialization statement (or expression) in a for loop.
13371 /// Code completion occurs within the condition of an if,
13372 /// while, switch, or for statement.
13374 /// Code completion occurs within the body of a function on a
13375 /// recovery path, where we do not have a specific handle on our position
13376 /// in the grammar.
13378 /// Code completion occurs where only a type is permitted.
13380 /// Code completion occurs in a parenthesized expression, which
13381 /// might also be a type cast.
13383 /// Code completion occurs within a sequence of declaration
13384 /// specifiers within a function, method, or block.
13385 PCC_LocalDeclarationSpecifiers
13387
13388 void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path);
13389 void CodeCompleteOrdinaryName(Scope *S,
13390 ParserCompletionContext CompletionContext);
13391 void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
13392 bool AllowNonIdentifiers,
13393 bool AllowNestedNameSpecifiers);
13394
13395 struct CodeCompleteExpressionData;
13396 void CodeCompleteExpression(Scope *S,
13397 const CodeCompleteExpressionData &Data);
13398 void CodeCompleteExpression(Scope *S, QualType PreferredType,
13399 bool IsParenthesized = false);
13400 void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
13401 SourceLocation OpLoc, bool IsArrow,
13402 bool IsBaseExprStatement,
13403 QualType PreferredType);
13404 void CodeCompletePostfixExpression(Scope *S, ExprResult LHS,
13405 QualType PreferredType);
13406 void CodeCompleteTag(Scope *S, unsigned TagSpec);
13407 void CodeCompleteTypeQualifiers(DeclSpec &DS);
13408 void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D,
13409 const VirtSpecifiers *VS = nullptr);
13410 void CodeCompleteBracketDeclarator(Scope *S);
13411 void CodeCompleteCase(Scope *S);
13413 Attribute,
13414 Scope,
13415 None,
13416 };
13417 void CodeCompleteAttribute(
13419 AttributeCompletion Completion = AttributeCompletion::Attribute,
13420 const IdentifierInfo *Scope = nullptr);
13421 /// Determines the preferred type of the current function argument, by
13422 /// examining the signatures of all possible overloads.
13423 /// Returns null if unknown or ambiguous, or if code completion is off.
13424 ///
13425 /// If the code completion point has been reached, also reports the function
13426 /// signatures that were considered.
13427 ///
13428 /// FIXME: rename to GuessCallArgumentType to reduce confusion.
13429 QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef<Expr *> Args,
13430 SourceLocation OpenParLoc);
13431 QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc,
13432 ArrayRef<Expr *> Args,
13433 SourceLocation OpenParLoc,
13434 bool Braced);
13435 QualType ProduceCtorInitMemberSignatureHelp(
13436 Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy,
13437 ArrayRef<Expr *> ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc,
13438 bool Braced);
13439 QualType ProduceTemplateArgumentSignatureHelp(
13440 TemplateTy, ArrayRef<ParsedTemplateArgument>, SourceLocation LAngleLoc);
13441 void CodeCompleteInitializer(Scope *S, Decl *D);
13442 /// Trigger code completion for a record of \p BaseType. \p InitExprs are
13443 /// expressions in the initializer list seen so far and \p D is the current
13444 /// Designation being parsed.
13445 void CodeCompleteDesignator(const QualType BaseType,
13446 llvm::ArrayRef<Expr *> InitExprs,
13447 const Designation &D);
13448 void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
13449
13450 void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
13451 bool IsUsingDeclaration, QualType BaseType,
13452 QualType PreferredType);
13453 void CodeCompleteUsing(Scope *S);
13454 void CodeCompleteUsingDirective(Scope *S);
13455 void CodeCompleteNamespaceDecl(Scope *S);
13456 void CodeCompleteNamespaceAliasDecl(Scope *S);
13457 void CodeCompleteOperatorName(Scope *S);
13458 void CodeCompleteConstructorInitializer(
13459 Decl *Constructor,
13460 ArrayRef<CXXCtorInitializer *> Initializers);
13461
13462 void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro,
13463 bool AfterAmpersand);
13464 void CodeCompleteAfterFunctionEquals(Declarator &D);
13465
13466 void CodeCompleteObjCAtDirective(Scope *S);
13467 void CodeCompleteObjCAtVisibility(Scope *S);
13468 void CodeCompleteObjCAtStatement(Scope *S);
13469 void CodeCompleteObjCAtExpression(Scope *S);
13470 void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS);
13471 void CodeCompleteObjCPropertyGetter(Scope *S);
13472 void CodeCompleteObjCPropertySetter(Scope *S);
13473 void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS,
13474 bool IsParameter);
13475 void CodeCompleteObjCMessageReceiver(Scope *S);
13476 void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
13478 bool AtArgumentExpression);
13479 void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
13481 bool AtArgumentExpression,
13482 bool IsSuper = false);
13483 void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
13485 bool AtArgumentExpression,
13486 ObjCInterfaceDecl *Super = nullptr);
13487 void CodeCompleteObjCForCollection(Scope *S,
13488 DeclGroupPtrTy IterationVar);
13489 void CodeCompleteObjCSelector(Scope *S,
13490 ArrayRef<IdentifierInfo *> SelIdents);
13491 void CodeCompleteObjCProtocolReferences(
13492 ArrayRef<IdentifierLocPair> Protocols);
13493 void CodeCompleteObjCProtocolDecl(Scope *S);
13494 void CodeCompleteObjCInterfaceDecl(Scope *S);
13495 void CodeCompleteObjCClassForwardDecl(Scope *S);
13496 void CodeCompleteObjCSuperclass(Scope *S,
13497 IdentifierInfo *ClassName,
13498 SourceLocation ClassNameLoc);
13499 void CodeCompleteObjCImplementationDecl(Scope *S);
13500 void CodeCompleteObjCInterfaceCategory(Scope *S,
13501 IdentifierInfo *ClassName,
13502 SourceLocation ClassNameLoc);
13503 void CodeCompleteObjCImplementationCategory(Scope *S,
13504 IdentifierInfo *ClassName,
13505 SourceLocation ClassNameLoc);
13506 void CodeCompleteObjCPropertyDefinition(Scope *S);
13507 void CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
13508 IdentifierInfo *PropertyName);
13509 void CodeCompleteObjCMethodDecl(Scope *S,
13510 std::optional<bool> IsInstanceMethod,
13511 ParsedType ReturnType);
13512 void CodeCompleteObjCMethodDeclSelector(Scope *S,
13513 bool IsInstanceMethod,
13514 bool AtParameterName,
13515 ParsedType ReturnType,
13516 ArrayRef<IdentifierInfo *> SelIdents);
13517 void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName,
13518 SourceLocation ClassNameLoc,
13519 bool IsBaseExprStatement);
13520 void CodeCompletePreprocessorDirective(bool InConditional);
13521 void CodeCompleteInPreprocessorConditionalExclusion(Scope *S);
13522 void CodeCompletePreprocessorMacroName(bool IsDefinition);
13523 void CodeCompletePreprocessorExpression();
13524 void CodeCompletePreprocessorMacroArgument(Scope *S,
13525 IdentifierInfo *Macro,
13527 unsigned Argument);
13528 void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
13529 void CodeCompleteNaturalLanguage();
13530 void CodeCompleteAvailabilityPlatformName();
13531 void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator,
13532 CodeCompletionTUInfo &CCTUInfo,
13534 //@}
13535
13536 //===--------------------------------------------------------------------===//
13537 // Extra semantic analysis beyond the C type system
13538
13539public:
13540 SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL,
13541 unsigned ByteNo) const;
13542
13544 FAPK_Fixed, // values to format are fixed (no C-style variadic arguments)
13545 FAPK_Variadic, // values to format are passed as variadic arguments
13546 FAPK_VAList, // values to format are passed in a va_list
13547 };
13548
13549 // Used to grab the relevant information from a FormatAttr and a
13550 // FunctionDeclaration.
13556
13557 static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
13558 bool IsVariadic, FormatStringInfo *FSI);
13559
13560private:
13561 void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
13562 const ArraySubscriptExpr *ASE = nullptr,
13563 bool AllowOnePastEnd = true, bool IndexNegated = false);
13564 void CheckArrayAccess(const Expr *E);
13565
13566 bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
13567 const FunctionProtoType *Proto);
13568 bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
13570 bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
13571 const FunctionProtoType *Proto);
13572 bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
13573 void CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType,
13575 const FunctionProtoType *Proto, SourceLocation Loc);
13576
13577 void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
13578
13579 void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
13580 StringRef ParamName, QualType ArgTy, QualType ParamTy);
13581
13582 void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
13583 const Expr *ThisArg, ArrayRef<const Expr *> Args,
13584 bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
13585 VariadicCallType CallType);
13586
13587 bool CheckObjCString(Expr *Arg);
13588 ExprResult CheckOSLogFormatStringArg(Expr *Arg);
13589
13590 ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
13591 unsigned BuiltinID, CallExpr *TheCall);
13592
13593 bool CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13594 CallExpr *TheCall);
13595
13596 void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall);
13597
13598 bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
13599 unsigned MaxWidth);
13600 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13601 CallExpr *TheCall);
13602 bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13603 bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13604 bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13605 CallExpr *TheCall);
13606 bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
13607 bool WantCDE);
13608 bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13609 CallExpr *TheCall);
13610
13611 bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13612 CallExpr *TheCall);
13613 bool CheckBPFBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13614 bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13615 bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
13616 bool CheckMipsBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13617 CallExpr *TheCall);
13618 bool CheckMipsBuiltinCpu(const TargetInfo &TI, unsigned BuiltinID,
13619 CallExpr *TheCall);
13620 bool CheckMipsBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
13621 bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13622 bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
13623 bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
13624 bool CheckX86BuiltinTileArguments(unsigned BuiltinID, CallExpr *TheCall);
13625 bool CheckX86BuiltinTileArgumentsRange(CallExpr *TheCall,
13626 ArrayRef<int> ArgNums);
13627 bool CheckX86BuiltinTileDuplicate(CallExpr *TheCall, ArrayRef<int> ArgNums);
13628 bool CheckX86BuiltinTileRangeAndDuplicate(CallExpr *TheCall,
13629 ArrayRef<int> ArgNums);
13630 bool CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13631 CallExpr *TheCall);
13632 bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13633 CallExpr *TheCall);
13634 bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13635 bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
13636 bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13637 CallExpr *TheCall);
13638 void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D);
13639 bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
13640 unsigned BuiltinID, CallExpr *TheCall);
13641 bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
13642 unsigned BuiltinID,
13643 CallExpr *TheCall);
13644 bool CheckNVPTXBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13645 CallExpr *TheCall);
13646
13647 bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
13648 bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
13649 bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
13650 bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
13651 bool SemaBuiltinComplex(CallExpr *TheCall);
13652 bool SemaBuiltinVSX(CallExpr *TheCall);
13653 bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
13654 bool SemaValueIsRunOfOnes(CallExpr *TheCall, unsigned ArgNum);
13655
13656public:
13657 // Used by C++ template instantiation.
13658 ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall);
13659 ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
13660 SourceLocation BuiltinLoc,
13661 SourceLocation RParenLoc);
13662
13663private:
13664 bool SemaBuiltinPrefetch(CallExpr *TheCall);
13665 bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
13666 bool SemaBuiltinArithmeticFence(CallExpr *TheCall);
13667 bool SemaBuiltinAssume(CallExpr *TheCall);
13668 bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
13669 bool SemaBuiltinLongjmp(CallExpr *TheCall);
13670 bool SemaBuiltinSetjmp(CallExpr *TheCall);
13671 ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
13672 ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
13673 ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
13675 ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
13676 bool IsDelete);
13677 bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
13678 llvm::APSInt &Result);
13679 bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low,
13680 int High, bool RangeIsError = true);
13681 bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
13682 unsigned Multiple);
13683 bool SemaBuiltinConstantArgPower2(CallExpr *TheCall, int ArgNum);
13684 bool SemaBuiltinConstantArgShiftedByte(CallExpr *TheCall, int ArgNum,
13685 unsigned ArgBits);
13686 bool SemaBuiltinConstantArgShiftedByteOrXXFF(CallExpr *TheCall, int ArgNum,
13687 unsigned ArgBits);
13688 bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
13689 int ArgNum, unsigned ExpectedFieldNum,
13690 bool AllowName);
13691 bool SemaBuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
13692 bool SemaBuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID,
13693 const char *TypeDesc);
13694
13695 bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
13696
13697 bool SemaBuiltinElementwiseMath(CallExpr *TheCall);
13698 bool SemaBuiltinElementwiseTernaryMath(CallExpr *TheCall);
13699 bool PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall);
13700 bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
13701
13702 bool SemaBuiltinNonDeterministicValue(CallExpr *TheCall);
13703
13704 // Matrix builtin handling.
13705 ExprResult SemaBuiltinMatrixTranspose(CallExpr *TheCall,
13706 ExprResult CallResult);
13707 ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
13708 ExprResult CallResult);
13709 ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
13710 ExprResult CallResult);
13711
13712 // WebAssembly builtin handling.
13713 bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
13714 bool BuiltinWasmRefNullFunc(CallExpr *TheCall);
13715 bool BuiltinWasmTableGet(CallExpr *TheCall);
13716 bool BuiltinWasmTableSet(CallExpr *TheCall);
13717 bool BuiltinWasmTableSize(CallExpr *TheCall);
13718 bool BuiltinWasmTableGrow(CallExpr *TheCall);
13719 bool BuiltinWasmTableFill(CallExpr *TheCall);
13720 bool BuiltinWasmTableCopy(CallExpr *TheCall);
13721
13722public:
13735 static FormatStringType GetFormatStringType(const FormatAttr *Format);
13736
13737 bool FormatStringHasSArg(const StringLiteral *FExpr);
13738
13739 static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
13740
13741private:
13742 bool CheckFormatArguments(const FormatAttr *Format,
13743 ArrayRef<const Expr *> Args, bool IsCXXMember,
13744 VariadicCallType CallType, SourceLocation Loc,
13745 SourceRange Range,
13746 llvm::SmallBitVector &CheckedVarArgs);
13747 bool CheckFormatArguments(ArrayRef<const Expr *> Args,
13748 FormatArgumentPassingKind FAPK, unsigned format_idx,
13749 unsigned firstDataArg, FormatStringType Type,
13750 VariadicCallType CallType, SourceLocation Loc,
13751 SourceRange range,
13752 llvm::SmallBitVector &CheckedVarArgs);
13753
13754 void CheckAbsoluteValueFunction(const CallExpr *Call,
13755 const FunctionDecl *FDecl);
13756
13757 void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
13758
13759 void CheckMemaccessArguments(const CallExpr *Call,
13760 unsigned BId,
13761 IdentifierInfo *FnName);
13762
13763 void CheckStrlcpycatArguments(const CallExpr *Call,
13764 IdentifierInfo *FnName);
13765
13766 void CheckStrncatArguments(const CallExpr *Call,
13767 IdentifierInfo *FnName);
13768
13769 void CheckFreeArguments(const CallExpr *E);
13770
13771 void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
13772 SourceLocation ReturnLoc,
13773 bool isObjCMethod = false,
13774 const AttrVec *Attrs = nullptr,
13775 const FunctionDecl *FD = nullptr);
13776
13777public:
13778 void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS,
13779 BinaryOperatorKind Opcode);
13780
13781private:
13782 void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
13784 void CheckForIntOverflow(const Expr *E);
13785 void CheckUnsequencedOperations(const Expr *E);
13786
13787 /// Perform semantic checks on a completed expression. This will either
13788 /// be a full-expression or a default argument expression.
13789 void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
13790 bool IsConstexpr = false);
13791
13792 void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
13793 Expr *Init);
13794
13795 /// Check if there is a field shadowing.
13796 void CheckShadowInheritedFields(const SourceLocation &Loc,
13797 DeclarationName FieldName,
13798 const CXXRecordDecl *RD,
13799 bool DeclIsField = true);
13800
13801 /// Check if the given expression contains 'break' or 'continue'
13802 /// statement that produces control flow different from GCC.
13803 void CheckBreakContinueBinding(Expr *E);
13804
13805 /// Check whether receiver is mutable ObjC container which
13806 /// attempts to add itself into the container
13807 void CheckObjCCircularContainer(ObjCMessageExpr *Message);
13808
13809 void CheckTCBEnforcement(const SourceLocation CallExprLoc,
13810 const NamedDecl *Callee);
13811
13812 void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
13813 void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
13814 bool DeleteWasArrayForm);
13815public:
13816 /// Register a magic integral constant to be used as a type tag.
13817 void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
13818 uint64_t MagicValue, QualType Type,
13819 bool LayoutCompatible, bool MustBeNull);
13820
13823
13824 TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull) :
13825 Type(Type), LayoutCompatible(LayoutCompatible),
13826 MustBeNull(MustBeNull)
13827 {}
13828
13830
13831 /// If true, \c Type should be compared with other expression's types for
13832 /// layout-compatibility.
13833 unsigned LayoutCompatible : 1;
13834 unsigned MustBeNull : 1;
13835 };
13836
13837 /// A pair of ArgumentKind identifier and magic value. This uniquely
13838 /// identifies the magic value.
13839 typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
13840
13841private:
13842 /// A map from magic value to type information.
13843 std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
13844 TypeTagForDatatypeMagicValues;
13845
13846 /// Peform checks on a call of a function with argument_with_type_tag
13847 /// or pointer_with_type_tag attributes.
13848 void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
13849 const ArrayRef<const Expr *> ExprArgs,
13850 SourceLocation CallSiteLoc);
13851
13852 /// Check if we are taking the address of a packed field
13853 /// as this may be a problem if the pointer value is dereferenced.
13854 void CheckAddressOfPackedMember(Expr *rhs);
13855
13856 /// The parser's current scope.
13857 ///
13858 /// The parser maintains this state here.
13859 Scope *CurScope;
13860
13861 mutable IdentifierInfo *Ident_super;
13862
13863 /// Nullability type specifiers.
13864 IdentifierInfo *Ident__Nonnull = nullptr;
13865 IdentifierInfo *Ident__Nullable = nullptr;
13866 IdentifierInfo *Ident__Nullable_result = nullptr;
13867 IdentifierInfo *Ident__Null_unspecified = nullptr;
13868
13869 IdentifierInfo *Ident_NSError = nullptr;
13870
13871 /// The handler for the FileChanged preprocessor events.
13872 ///
13873 /// Used for diagnostics that implement custom semantic analysis for #include
13874 /// directives, like -Wpragma-pack.
13875 sema::SemaPPCallbacks *SemaPPCallbackHandler;
13876
13877protected:
13878 friend class Parser;
13880 friend class ASTReader;
13881 friend class ASTDeclReader;
13882 friend class ASTWriter;
13883
13884public:
13885 /// Retrieve the keyword associated
13886 IdentifierInfo *getNullabilityKeyword(NullabilityKind nullability);
13887
13888 /// The struct behind the CFErrorRef pointer.
13889 RecordDecl *CFError = nullptr;
13890 bool isCFError(RecordDecl *D);
13891
13892 /// Retrieve the identifier "NSError".
13893 IdentifierInfo *getNSErrorIdent();
13894
13895 /// Retrieve the parser's current scope.
13896 ///
13897 /// This routine must only be used when it is certain that semantic analysis
13898 /// and the parser are in precisely the same context, which is not the case
13899 /// when, e.g., we are performing any kind of template instantiation.
13900 /// Therefore, the only safe places to use this scope are in the parser
13901 /// itself and in routines directly invoked from the parser and *never* from
13902 /// template substitution or instantiation.
13903 Scope *getCurScope() const { return CurScope; }
13904
13906 return CurScope->incrementMSManglingNumber();
13907 }
13908
13909 IdentifierInfo *getSuperIdentifier() const;
13910
13911 ObjCContainerDecl *getObjCDeclContext() const;
13912
13914 return OriginalLexicalContext ? OriginalLexicalContext : CurContext;
13915 }
13916
13918 const DeclContext *DC = getCurLexicalContext();
13919 // A category implicitly has the attribute of the interface.
13920 if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
13921 DC = CatD->getClassInterface();
13922 return DC;
13923 }
13924
13925 /// Determine the number of levels of enclosing template parameters. This is
13926 /// only usable while parsing. Note that this does not include dependent
13927 /// contexts in which no template parameters have yet been declared, such as
13928 /// in a terse function template or generic lambda before the first 'auto' is
13929 /// encountered.
13930 unsigned getTemplateDepth(Scope *S) const;
13931
13932 /// To be used for checking whether the arguments being passed to
13933 /// function exceeds the number of parameters expected for it.
13934 static bool TooManyArguments(size_t NumParams, size_t NumArgs,
13935 bool PartialOverloading = false) {
13936 // We check whether we're just after a comma in code-completion.
13937 if (NumArgs > 0 && PartialOverloading)
13938 return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
13939 return NumArgs > NumParams;
13940 }
13941
13942 // Emitting members of dllexported classes is delayed until the class
13943 // (including field initializers) is fully parsed.
13946
13947private:
13948 int ParsingClassDepth = 0;
13949
13950 class SavePendingParsedClassStateRAII {
13951 public:
13952 SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
13953
13954 ~SavePendingParsedClassStateRAII() {
13955 assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
13956 "there shouldn't be any pending delayed exception spec checks");
13957 assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
13958 "there shouldn't be any pending delayed exception spec checks");
13959 swapSavedState();
13960 }
13961
13962 private:
13963 Sema &S;
13964 decltype(DelayedOverridingExceptionSpecChecks)
13965 SavedOverridingExceptionSpecChecks;
13966 decltype(DelayedEquivalentExceptionSpecChecks)
13967 SavedEquivalentExceptionSpecChecks;
13968
13969 void swapSavedState() {
13970 SavedOverridingExceptionSpecChecks.swap(
13971 S.DelayedOverridingExceptionSpecChecks);
13972 SavedEquivalentExceptionSpecChecks.swap(
13973 S.DelayedEquivalentExceptionSpecChecks);
13974 }
13975 };
13976
13977 /// Helper class that collects misaligned member designations and
13978 /// their location info for delayed diagnostics.
13979 struct MisalignedMember {
13980 Expr *E;
13981 RecordDecl *RD;
13982 ValueDecl *MD;
13983 CharUnits Alignment;
13984
13985 MisalignedMember() : E(), RD(), MD() {}
13986 MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
13987 CharUnits Alignment)
13988 : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
13989 explicit MisalignedMember(Expr *E)
13990 : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
13991
13992 bool operator==(const MisalignedMember &m) { return this->E == m.E; }
13993 };
13994 /// Small set of gathered accesses to potentially misaligned members
13995 /// due to the packed attribute.
13996 SmallVector<MisalignedMember, 4> MisalignedMembers;
13997
13998 /// Adds an expression to the set of gathered misaligned members.
13999 void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
14000 CharUnits Alignment);
14001
14002public:
14003 /// Diagnoses the current set of gathered accesses. This typically
14004 /// happens at full expression level. The set is cleared after emitting the
14005 /// diagnostics.
14006 void DiagnoseMisalignedMembers();
14007
14008 /// This function checks if the expression is in the sef of potentially
14009 /// misaligned members and it is converted to some pointer type T with lower
14010 /// or equal alignment requirements. If so it removes it. This is used when
14011 /// we do not want to diagnose such misaligned access (e.g. in conversions to
14012 /// void*).
14013 void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
14014
14015 /// This function calls Action when it determines that E designates a
14016 /// misaligned member due to the packed attribute. This is used to emit
14017 /// local diagnostics like in reference binding.
14018 void RefersToMemberWithReducedAlignment(
14019 Expr *E,
14020 llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
14021 Action);
14022
14023 /// Describes the reason a calling convention specification was ignored, used
14024 /// for diagnostics.
14026 ForThisTarget = 0,
14027 VariadicFunction,
14028 ConstructorDestructor,
14029 BuiltinFunction
14030 };
14031 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
14032 /// context is "used as device code".
14033 ///
14034 /// - If CurLexicalContext is a kernel function or it is known that the
14035 /// function will be emitted for the device, emits the diagnostics
14036 /// immediately.
14037 /// - If CurLexicalContext is a function and we are compiling
14038 /// for the device, but we don't know that this function will be codegen'ed
14039 /// for devive yet, creates a diagnostic which is emitted if and when we
14040 /// realize that the function will be codegen'ed.
14041 ///
14042 /// Example usage:
14043 ///
14044 /// Diagnose __float128 type usage only from SYCL device code if the current
14045 /// target doesn't support it
14046 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
14047 /// S.getLangOpts().SYCLIsDevice)
14048 /// SYCLDiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
14049 SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc,
14050 unsigned DiagID);
14051
14052 void deepTypeCheckForSYCLDevice(SourceLocation UsedAt,
14054 ValueDecl *DeclToCheck);
14055};
14056
14057DeductionFailureInfo
14058MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK,
14059 sema::TemplateDeductionInfo &Info);
14060
14061/// Contains a late templated function.
14062/// Will be parsed at the end of the translation unit, used by Sema & Parser.
14065 /// The template function declaration to be late parsed.
14067 /// Floating-point options in the point of definition.
14069};
14070
14071template <>
14073 PragmaMsStackAction Action,
14074 llvm::StringRef StackSlotLabel,
14076
14077std::unique_ptr<sema::RISCVIntrinsicManager>
14079} // end namespace clang
14080
14081namespace llvm {
14082// Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
14083// SourceLocation.
14084template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
14087 DenseMapInfo<clang::CanonicalDeclPtr<const clang::FunctionDecl>>;
14088
14090 return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
14091 }
14092
14094 return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
14095 }
14096
14097 static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
14098 return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
14099 FDL.Loc.getHashValue());
14100 }
14101
14102 static bool isEqual(const FunctionDeclAndLoc &LHS,
14103 const FunctionDeclAndLoc &RHS) {
14104 return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
14105 }
14106};
14107} // namespace llvm
14108
14109#endif
This file provides AST data structures related to concepts.
#define V(N, I)
int Id
Definition ASTDiff.cpp:190
Forward declaration of all AST node types.
MatchType Type
StringRef P
#define SM(sm)
Definition Cuda.cpp:80
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
auto * N
Defines enum values for all the target-independent builtin functions.
llvm::APSInt APSInt
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines enumerations for expression traits intrinsics.
Token Tok
The Token.
FormatToken * Previous
The previous token in the unwrapped line.
unsigned Offset
Definition Format.cpp:2924
bool IsStatic
Definition Format.cpp:2934
StringRef Identifier
Definition Format.cpp:2930
llvm::DenseSet< const void * > Visited
#define X(type, name)
Definition Value.h:94
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::OpenCLOptions class.
Defines some OpenMP-specific enums and functions.
AccessResult
A copy of Sema's enum without AR_delayed.
CastType
Definition SemaCast.cpp:47
static void CheckBoolLikeConversion(Sema &S, Expr *E, SourceLocation CC)
Check conversion of given expression to boolean.
Sema::AllowedExplicit AllowedExplicit
Defines various enumerations that describe declaration and type specifiers.
const char * Data
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TemplateNameKind enum.
Defines the clang::TypeLoc interface and its subclasses.
Allows QualTypes to be sorted and hence used in maps and sets.
Defines enumerations for the type traits support.
TypePropertyCache< Private > Cache
Definition Type.cpp:4134
SourceLocation Begin
std::string Label
A class for storing results from argument-dependent lookup.
Definition Lookup.h:832
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition ASTConsumer.h:33
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:182
CanQualType BoolTy
CanQualType IntTy
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Definition ASTReader.h:366
Writes an AST file containing the contents of a translation unit.
Definition ASTWriter.h:86
Represents an access specifier followed by colon ':'.
Definition DeclCXX.h:86
bool isInvalid() const
Definition Ownership.h:165
PtrTy get() const
Definition Ownership.h:169
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2675
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition Type.h:3063
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition Type.h:3069
Attr - This represents one attribute.
Definition Attr.h:40
Syntax
The style used to specify an attribute.
Represents a C++ declaration that introduces decls from somewhere else.
Definition DeclCXX.h:3371
A binding in a decomposition declaration.
Definition DeclCXX.h:4060
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4371
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a C++ constructor within a class.
Definition DeclCXX.h:2491
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2818
Represents a C++ base or member initializer.
Definition DeclCXX.h:2259
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2481
Represents a C++ destructor within a class.
Definition DeclCXX.h:2755
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2035
Represents a C++ struct/union/class.
Definition DeclCXX.h:254
Represents a C++ nested-name-specifier or a global scope specifier.
Definition DeclSpec.h:73
Represents the this expression in C++.
Definition ExprCXX.h:1148
CXXTryStmt - A C++ try block, including all handlers.
Definition StmtCXX.h:69
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2831
A wrapper class around a pointer that always points to its canonical declaration.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4563
CaseStmt - Represent a case statement.
Definition Stmt.h:1622
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3501
CharUnits - This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Abstract interface for a consumer of code-completion information.
An allocator used specifically for the purpose of code completion.
Declaration of a C++20 concept.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:28
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3552
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
The information about the darwin SDK that was used during this compilation.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
Definition DeclBase.h:1347
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1409
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1242
Captures information about "declaration specifiers".
Definition DeclSpec.h:246
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:83
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Definition DeclBase.h:827
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:811
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:946
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
Definition Decl.h:765
Information about one declarator, including the parsed type information and the identifier.
Definition DeclSpec.h:1850
A decomposition declaration.
Definition DeclCXX.h:4119
A dependently-generated diagnostic.
Designation - Represent a full designation, which is a sequence of designators.
Definition Designator.h:208
A little helper class used to produce diagnostics.
void Clear() const
Clear out the current diagnostic.
bool isActive() const
Determine whether this diagnostic is still active.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:192
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition Diagnostic.h:756
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3189
Represents an enum.
Definition Decl.h:3750
Store information needed for an explicit specifier.
Definition DeclCXX.h:1882
Represents a standard C++ module export declaration.
Definition Decl.h:4755
The return type of classify().
Definition Expr.h:324
This represents one expression.
Definition Expr.h:110
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
Definition Expr.h:772
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:330
An abstract interface that should be implemented by external AST sources that also provide informatio...
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source.
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
Represents difference between two FPOptions values.
FPOptionsOverride getChangesFrom(const FPOptions &Base) const
Return difference with the given option set.
Represents a member of a struct/union/class.
Definition Decl.h:2960
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A mapping from file IDs to a record of whether we've seen nullability information in that file.
Definition Sema.h:265
FileNullability & operator[](FileID file)
Definition Sema.h:276
FileNullability Nullability
Definition Sema.h:272
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition Diagnostic.h:71
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition DeclFriend.h:54
Represents a function declaration or definition.
Definition Decl.h:1917
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition ExprCXX.h:4492
Represents a prototype with parameter type info, e.g.
Definition Type.h:4076
Declaration of a template function.
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition Type.h:3755
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition Type.h:3729
One of these records is kept for each identifier that is lexed.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition Overload.h:520
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3229
Describes an C or C++ initializer list.
Definition Expr.h:4829
Describes the kind of initialization being performed, along with location information for tokens rela...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
Represents the declaration of a label.
Definition Decl.h:494
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition LangOptions.h:82
FPExceptionModeKind
Possible floating point exception behavior.
FPEvalMethodKind
Possible float expression evaluation method choices.
Represents a lazily-loaded vector of data.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition Template.h:363
Represents the results of name lookup.
Definition Lookup.h:46
A global _GUID constant.
Definition DeclCXX.h:4242
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4188
Encapsulates the data about a macro definition (e.g.
Definition MacroInfo.h:39
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4572
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3194
Abstract interface for a module loader.
Describes a module or submodule.
Definition Module.h:98
bool isModulePurview() const
Does this Module scope describe part of the purview of a standard named C++ module?
Definition Module.h:176
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition Template.h:76
static const unsigned NumNSNumberLiteralMethods
Definition NSAPI.h:191
This represents a decl that may have a name.
Definition Decl.h:247
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Definition Decl.h:411
Represent a C++ namespace.
Definition Decl.h:542
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This is a basic class for representing single OpenMP clause.
This represents '#pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:171
This represents '#pragma omp requires...' directive.
Definition DeclOpenMP.h:416
This represents '#pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2312
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition DeclObjC.h:2531
ObjCContainerDecl - Represents a container for method declarations.
Definition DeclObjC.h:941
Captures information about "declaration specifiers" specific to Objective-C.
Definition DeclSpec.h:861
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2584
Represents an ObjC class declaration.
Definition DeclObjC.h:1147
ObjCIvarDecl - Represents an ObjC instance variable.
Definition DeclObjC.h:1939
ObjCList - This is a simple template class used to hold various lists of decls etc,...
Definition Sema.h:161
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:942
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:138
Represents a pointer to an Objective C object.
Definition Type.h:6332
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:729
Represents an Objective-C protocol declaration.
Definition DeclObjC.h:2069
Represents the declaration of an Objective-C type parameter.
Definition DeclObjC.h:579
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition DeclObjC.h:658
Wrapper for void* pointer.
Definition Ownership.h:50
static OpaquePtr make(QualType P)
Definition Ownership.h:60
OpenCL supported extensions and optional core features.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition Overload.h:954
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition ExprCXX.h:2962
ParenExpr - This represents a parethesized expression, e.g.
Definition Expr.h:2142
Represents a parameter to a function.
Definition Decl.h:1722
ParsedAttr - Represents a syntactic attribute.
Definition ParsedAttr.h:123
ParsedAttributes - A collection of parsed attributes.
Definition ParsedAttr.h:920
Represents the parsed form of a C++ template argument.
Parser - This implements a parser for the C family of languages.
Definition Parser.h:62
void Emit(const DiagnosticBuilder &DB) const
Tracks expected type during expression parsing, for use in code completion.
Definition Sema.h:297
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterDesignatedInitializer(SourceLocation Tok, QualType BaseType, const Designation &D)
Handles e.g. BaseType{ .D = Tok...
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
PreferredTypeBuilder(bool Enabled)
Definition Sema.h:299
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
Definition Sema.h:334
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Stores the type being destroyed by a pseudo-destructor expression.
Definition ExprCXX.h:2549
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6285
A (possibly-)qualified type.
Definition Type.h:736
The collection of all-type qualifiers we support.
Definition Type.h:146
Represents a struct/union/class.
Definition Decl.h:4028
Represents the body of a requires-expression.
Definition DeclCXX.h:2013
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Scope - A scope is a transient data structure that is used while parsing the program.
Definition Scope.h:41
void incrementMSManglingNumber()
Definition Scope.h:336
Smart pointer class that efficiently represents Objective-C method names.
AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
Definition Sema.h:498
bool operator==(const AlignPackInfo &Info) const
Definition Sema.h:558
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition Sema.h:530
unsigned getPackNumber() const
Definition Sema.h:548
bool IsXLStack() const
Definition Sema.h:556
bool IsPackSet() const
Definition Sema.h:550
AlignPackInfo(AlignPackInfo::Mode M, bool IsXL)
Definition Sema.h:504
bool IsAlignAttr() const
Definition Sema.h:544
bool IsPackAttr() const
Definition Sema.h:542
bool operator!=(const AlignPackInfo &Info) const
Definition Sema.h:564
AlignPackInfo(bool IsXL)
Definition Sema.h:508
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Definition Sema.h:515
Mode getAlignMode() const
Definition Sema.h:546
RAII object used to change the argument pack substitution index within a Sema object.
Definition Sema.h:9544
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition Sema.h:9549
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition Sema.h:2240
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2245
void emit(const SemaDiagnosticBuilder &DB, std::index_sequence< Is... >) const
Definition Sema.h:2232
std::tuple< const Ts &... > Args
Definition Sema.h:2229
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition Sema.h:6723
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
A RAII object to enter scope of a compound statement.
Definition Sema.h:5087
CompoundScopeRAII(Sema &S, bool IsStmtExpr=false)
Definition Sema.h:5089
std::pair< VarDecl *, Expr * > get() const
Definition Sema.h:12962
std::optional< bool > getKnownValue() const
Definition Sema.h:12966
A RAII object to temporarily push a declaration context.
Definition Sema.h:1019
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition Sema.h:1029
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition Sema.h:3917
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition Sema.h:3922
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
For a defaulted function, the kind of defaulted function that it is.
Definition Sema.h:3434
DefaultedComparisonKind asComparison() const
Definition Sema.h:3457
DefaultedFunctionKind(CXXSpecialMember CSM)
Definition Sema.h:3442
CXXSpecialMember asSpecialMember() const
Definition Sema.h:3456
unsigned getDiagnosticIndex() const
Get the index of this function kind for use in diagnostics.
Definition Sema.h:3460
DefaultedFunctionKind(DefaultedComparisonKind Comp)
Definition Sema.h:3444
RAII class to control scope of DeferDiags.
Definition Sema.h:1922
DeferDiagsRAII(Sema &S, bool DeferDiags)
Definition Sema.h:1927
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
Definition Sema.h:967
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition Sema.h:988
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition Sema.h:1012
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition Sema.h:979
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition Sema.h:982
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition Sema.h:998
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition Sema.h:1004
A helper class for building up ExtParameterInfos.
Definition Sema.h:10037
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition Sema.h:10056
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition Sema.h:10044
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Definition Sema.h:1627
FPOptionsOverride getOverrides()
Definition Sema.h:1631
FullExprArg(Sema &actions)
Definition Sema.h:5038
ExprResult release()
Definition Sema.h:5040
Expr * get() const
Definition Sema.h:5044
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition Sema.h:9956
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition Sema.h:1535
iterator find(Selector Sel)
Definition Sema.h:1538
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition Sema.h:1534
int count(Selector Sel) const
Definition Sema.h:1542
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition Sema.h:1539
SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
Definition Sema.h:3978
virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
bool match(QualType T) override
Match an integral or (possibly scoped) enumeration type.
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition Sema.h:3969
Helper class that creates diagnostics with optional template instantiation stacks.
Definition Sema.h:1724
const ImmediateDiagBuilder & operator<<(T &&V) const
Definition Sema.h:1774
ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1731
friend const ImmediateDiagBuilder & operator<<(const ImmediateDiagBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition Sema.h:1763
ImmediateDiagBuilder(const ImmediateDiagBuilder &)=default
ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1729
Helper class that collects exception specifications for implicitly-declared special member functions.
Definition Sema.h:6353
unsigned size() const
The number of exceptions in the exception specification.
Definition Sema.h:6386
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition Sema.h:6379
const QualType * data() const
The set of exceptions in the exception specification.
Definition Sema.h:6389
void CalledStmt(Stmt *S)
Integrate an invoked statement into the collected data.
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
Definition Sema.h:6395
void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method)
Integrate another called method into the collected data.
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition Sema.h:6402
static NameClassification DependentNonType()
Definition Sema.h:2747
static NameClassification VarTemplate(TemplateName Name)
Definition Sema.h:2757
ExprResult getExpression() const
Definition Sema.h:2783
NameClassification(const IdentifierInfo *Keyword)
Definition Sema.h:2721
static NameClassification Unknown()
Definition Sema.h:2727
static NameClassification OverloadSet(ExprResult E)
Definition Sema.h:2731
NameClassificationKind getKind() const
Definition Sema.h:2781
static NameClassification UndeclaredTemplate(TemplateName Name)
Definition Sema.h:2775
static NameClassification FunctionTemplate(TemplateName Name)
Definition Sema.h:2763
NamedDecl * getNonTypeDecl() const
Definition Sema.h:2793
NameClassification(ParsedType Type)
Definition Sema.h:2719
TemplateName getTemplateName() const
Definition Sema.h:2798
ParsedType getType() const
Definition Sema.h:2788
TemplateNameKind getTemplateNameKind() const
Definition Sema.h:2805
static NameClassification NonType(NamedDecl *D)
Definition Sema.h:2737
static NameClassification Concept(TemplateName Name)
Definition Sema.h:2769
static NameClassification UndeclaredNonType()
Definition Sema.h:2743
static NameClassification TypeTemplate(TemplateName Name)
Definition Sema.h:2751
static NameClassification Error()
Definition Sema.h:2723
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
Definition Sema.h:2002
void operator()(sema::FunctionScopeInfo *Scope) const
Definition Sema.cpp:2269
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition SemaAttr.cpp:28
Whether and why a template name is required in this lookup.
Definition Sema.h:8077
RequiredTemplateKind(TemplateNameIsRequiredTag)
Template name is unconditionally required.
Definition Sema.h:8083
SourceLocation getTemplateKeywordLoc() const
Definition Sema.h:8085
RequiredTemplateKind(SourceLocation TemplateKWLoc=SourceLocation())
Template name is required if TemplateKWLoc is valid.
Definition Sema.h:8080
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition Sema.h:9853
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition Sema.h:9884
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition Sema.h:9861
A generic diagnostic builder for errors which may or may not be deferred.
Definition Sema.h:1795
void AddFixItHint(const FixItHint &Hint) const
Definition Sema.h:1871
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Definition Sema.h:1840
const SemaDiagnosticBuilder & operator<<(T &&V) const
Definition Sema.h:1854
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
Definition Sema.h:1881
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, const FunctionDecl *Fn, Sema &S)
Definition Sema.cpp:1831
@ K_Nop
Emit no diagnostics.
Definition Sema.h:1799
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
Definition Sema.h:1809
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Definition Sema.h:1805
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Definition Sema.h:1801
SemaDiagnosticBuilder & operator=(SemaDiagnosticBuilder &&)=delete
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
Definition Sema.h:1878
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
SemaDiagnosticBuilder & operator=(const SemaDiagnosticBuilder &)=delete
A derivative of BoundTypeDiagnoser for which the diagnostic's type parameter is preceded by a 0/1 enu...
Definition Sema.h:2267
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2272
SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
Definition Sema.h:2269
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition Sema.h:1471
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition Sema.h:1444
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition Sema.h:1457
CXXMethodDecl * getMethod() const
Definition Sema.h:1460
void setMethod(CXXMethodDecl *MD)
Definition Sema.h:1461
RAII object to handle the state changes required to synthesize a function body.
Definition Sema.h:1076
void addContextNote(SourceLocation UseLoc)
Definition Sema.h:1100
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition Sema.h:1082
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition Sema.h:9893
TentativeAnalysisScope(Sema &SemaRef)
Definition Sema.h:9899
Abstract base class used for diagnosing integer constant expression violations.
Definition Sema.h:13030
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
VerifyICEDiagnoser(bool Suppress=false)
Definition Sema.h:13034
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:356
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority)
Attribute merging methods. Return true if a new attribute was added.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
const FieldDecl * getSelfAssignmentClassMemberCandidate(const ValueDecl *SelfAssigned)
Returns a field in a CXXRecordDecl that has the same name as the decl SelfAssigned when inside a CXXM...
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs)
OMPClause * ActOnOpenMPMapClause(Expr *IteratorModifier, ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'map' clause.
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType.
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
QualType CheckSizelessVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
QualType BuildParenType(QualType T)
Build a paren type including T.
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
StmtResult ActOnOpenMPMetaDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp metadirective' after parsing of the associated statement.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
Definition Sema.h:3471
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn)
#pragma optimize("[optimization-list]", on | off).
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraint)
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result, ASTContext &Ctx, bool ErrorOnInvalidMessage)
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, OMPInteropInfo &InteropInfo, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
std::optional< ExpressionEvaluationContextRecord::InitializationContext > InnermostDeclarationWithDelayedImmediateInvocations() const
Definition Sema.h:9819
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
Definition SemaAttr.cpp:388
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition Sema.h:9473
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition Sema.h:4021
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition Sema.h:1559
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition Sema.h:9911
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition Sema.h:13903
void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls)
MergeTypedefNameDecl - We just parsed a typedef 'New' which has the same name and scope as a previous...
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S)
Register the given locally-scoped extern "C" declaration so that it can be found later for redeclarat...
const ValueDecl * getOpenMPDeclareMapperVarName() const
BTFDeclTagAttr * mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL)
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
OMPClause * ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
SmallVector< SmallVector< VTableUse, 16 >, 8 > SavedVTableUses
Definition Sema.h:9950
void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation > > ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
void PopParsingClass(ParsingClassState state)
Definition Sema.h:5397
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2574
void DiagnoseAbstractType(const CXXRecordDecl *RD)
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc, const LookupResult *R=nullptr, const UsingDecl *UD=nullptr)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition Sema.h:800
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition Sema.cpp:923
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
llvm::SmallPtrSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition Sema.h:1583
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter,...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
QualType CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
bool checkArrayElementAlignment(QualType EltTy, SourceLocation Loc)
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs, SmallVectorImpl< const Attr * > &OutAttrs)
Process the attributes before creating an attributed statement.
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input, bool IsAfterAmp=false)
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
bool isValidRVVBitcast(QualType srcType, QualType destType)
Are the two types RVV-bitcast-compatible types? I.e.
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
bool isExternalWithNoLinkageType(const ValueDecl *VD) const
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
Definition Sema.cpp:796
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, std::optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition Sema.cpp:2454
LookupNameKind
Describes the kind of name lookup to perform.
Definition Sema.h:4335
@ LookupLabel
Label name lookup.
Definition Sema.h:4344
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition Sema.h:4339
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
Definition Sema.h:4366
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition Sema.h:4358
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
Definition Sema.h:4380
@ LookupLocalFriendName
Look up a friend of a local class.
Definition Sema.h:4374
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
Definition Sema.h:4376
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition Sema.h:4371
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition Sema.h:4351
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
Definition Sema.h:4378
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Definition Sema.h:4362
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
Definition Sema.h:4347
@ LookupDestructorName
Look up a name following ~ in a destructor name.
Definition Sema.h:4354
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition Sema.h:4342
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
Definition Sema.h:4382
@ LookupAnyName
Look up any declaration with any name.
Definition Sema.h:4384
UnaryTransformType::UTTKind UTTKind
Definition Sema.h:2603
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
ExprResult ActOnConstantExpression(ExprResult Res)
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition SemaAttr.cpp:514
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:8038
@ VariadicDoesNotApply
Definition Sema.h:12423
@ VariadicFunction
Definition Sema.h:12419
@ VariadicMethod
Definition Sema.h:12421
@ VariadicConstructor
Definition Sema.h:12422
@ VariadicBlock
Definition Sema.h:12420
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition Sema.h:926
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, std::optional< unsigned > NumExpansions, bool ExpectParameterPack, bool EvaluateConstraints=true)
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
void ActOnFinishCXXNonNestedClass()
ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
Decl * ActOnTopLevelStmtDecl(Stmt *Statement)
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
NonTrivialCUnionContext
Definition Sema.h:3032
@ NTCUC_CopyInit
Definition Sema.h:3042
@ NTCUC_AutoVar
Definition Sema.h:3040
@ NTCUC_CompoundLiteral
Definition Sema.h:3046
@ NTCUC_DefaultInitializedObject
Definition Sema.h:3038
@ NTCUC_Assignment
Definition Sema.h:3044
@ NTCUC_BlockCapture
Definition Sema.h:3048
@ NTCUC_FunctionReturn
Definition Sema.h:3036
@ NTCUC_LValueToRValueVolatile
Definition Sema.h:3050
@ NTCUC_FunctionParam
Definition Sema.h:3034
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition Sema.h:779
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld, bool NewDeclIsDefn)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
bool hasReachableDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
MissingImportKind
Kinds of missing import.
Definition Sema.h:3268
StmtResult ActOnOpenMPScanDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scan'.
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition Sema.h:879
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition Sema.h:9489
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc)
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl * > LocalParameters, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
bool areVectorTypesSameSize(QualType srcType, QualType destType)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
void DiagnoseStaticAssertDetails(const Expr *E)
Try to print more useful information about a failed static_assert with expression \E.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition Sema.cpp:1897
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
RetainOwnershipKind
Definition Sema.h:11006
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
bool IsStringInit(Expr *Init, const ArrayType *AT)
Definition SemaInit.cpp:162
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition Sema.h:1223
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition Sema.h:1214
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition Sema.h:4443
void addImplicitTypedef(StringRef Name, QualType T)
Definition Sema.cpp:261
void PrintContextStack()
Definition Sema.h:9766
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable,...
std::pair< StringRef, QualType > CapturedParamNameType
Definition Sema.h:5212
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition SemaStmt.cpp:583
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
void ActOnOpenMPEndAssumesDirective()
Called on well-formed '#pragma omp end assumes'.
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true, bool ConsiderRequiresClauses=true)
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition Sema.h:6079
@ IER_DoesNotExist
The symbol does not exist.
Definition Sema.h:6084
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
Definition Sema.h:6088
@ IER_Error
An error occurred.
Definition Sema.h:6091
@ IER_Exists
The symbol exists.
Definition Sema.h:6081
void CheckDelegatingCtorCycles()
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, MultiExprArg Args)
CUDAFunctionPreference
Definition Sema.h:13223
@ CFP_HostDevice
Definition Sema.h:13228
@ CFP_SameSide
Definition Sema.h:13229
@ CFP_WrongSide
Definition Sema.h:13225
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition Sema.h:2425
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
void ActOnStmtExprError()
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
Definition Sema.h:1905
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition Sema.h:1226
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition Sema.h:2216
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
StmtResult ActOnForEachLValueExpr(Expr *E)
In an Objective C collection iteration statement: for (x in y) x can be an arbitrary l-value expressi...
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition Sema.h:1491
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition Sema.h:882
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
FunctionEmissionStatus
Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
Definition Sema.h:4549
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition Sema.h:871
PragmaClangSection PragmaClangRodataSection
Definition Sema.h:470
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, bool Final=false, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet, OverloadedOperatorKind Op, const UnresolvedSetImpl &Fns, ArrayRef< Expr * > Args, bool RequiresADL=true)
Perform lookup for an overloaded binary operator.
void NoteAllFoundTemplates(TemplateName Name)
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, unsigned LambdaDependencyKind, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
bool hasVisibleDefinition(const NamedDecl *D)
Definition Sema.h:2452
ObjCContainerKind
Definition Sema.h:10303
@ OCK_Interface
Definition Sema.h:10305
@ OCK_ClassExtension
Definition Sema.h:10308
@ OCK_Category
Definition Sema.h:10307
@ OCK_Implementation
Definition Sema.h:10309
@ OCK_CategoryImplementation
Definition Sema.h:10310
@ OCK_Protocol
Definition Sema.h:10306
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Definition Sema.h:920
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
void emitAndClearUnusedLocalTypedefWarnings()
Definition Sema.cpp:1014
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition Sema.h:862
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseModifier Modifier, OpenMPOrderClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition SemaStmt.cpp:84
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition Sema.h:1190
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
VarDecl * buildCoroutinePromise(SourceLocation Loc)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
unsigned CapturingFunctionScopes
Track the number of currently active capturing scopes.
Definition Sema.h:828
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition Sema.h:13091
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:5007
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
PragmaClangSectionAction
Definition Sema.h:457
@ PCSA_Set
Definition Sema.h:458
@ PCSA_Clear
Definition Sema.h:459
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition Sema.cpp:267
@ Switch
An integral condition for a 'switch' statement.
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Definition Sema.h:2530
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
static SourceRange getPrintable(SourceLocation L)
Definition Sema.h:2222
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition Sema.h:891
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
@ PartitionImplementation
'module X:Y;'
@ Interface
'export module X;'
@ PartitionInterface
'export module X:Y;'
WebAssemblyImportNameAttr * mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL)
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition Sema.h:821
void ActOnExitFunctionContext()
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool ActOnDuplicateODRHashDefinition(T *Duplicate, T *Previous)
Check ODR hashes for C/ObjC when merging types from modules.
Definition Sema.h:3504
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition Sema.h:12800
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
Definition Sema.h:12803
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
Definition Sema.h:12809
@ Ref_Related
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition Sema.h:12807
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo &ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType)
Definition Sema.h:8005
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
@ AR_dependent
Definition Sema.h:7941
@ AR_accessible
Definition Sema.h:7939
@ AR_inaccessible
Definition Sema.h:7940
@ AR_delayed
Definition Sema.h:7942
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Definition Sema.cpp:2246
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
CompleteTypeKind
Definition Sema.h:2279
@ Normal
Apply the normal rules for complete types.
@ AcceptSizeless
Relax the normal rules for complete types so that they include sizeless built-in types.
bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA)
Check whether the given statement can have musttail applied to it, issuing a diagnostic and returning...
Definition SemaStmt.cpp:612
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
Adds a conversion function template specialization candidate to the overload set, using template argu...
Preprocessor & getPreprocessor() const
Definition Sema.h:1686
OMPClause * ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'dynamic_allocators' clause.
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition Sema.cpp:2108
QualType GetSignedSizelessVectorType(QualType V)
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition Sema.h:9476
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, Scope *CurContext)
Once the Lambdas capture are known, we can start to create the closure, call operator method,...
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:399
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
llvm::SmallPtrSet< ConstantExpr *, 4 > FailedImmediateInvocations
Definition Sema.h:1425
void deduceOpenCLAddressSpace(ValueDecl *decl)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition Sema.h:702
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
void CheckHLSLEntryPoint(FunctionDecl *FD)
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
Definition Sema.h:3474
static SourceRange getPrintable(const Expr *E)
Definition Sema.h:2223
PragmaStack< StringLiteral * > CodeSegStack
Definition Sema.h:696
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
void referenceDLLExportedClassMethods()
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition Sema.h:9921
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
void MarkCaptureUsedInEnclosingContext(ValueDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
void setFunctionHasBranchIntoScope()
Definition Sema.cpp:2297
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
Definition SemaCUDA.cpp:50
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition Sema.h:859
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
Definition SemaStmt.cpp:459
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimizeoff". If this location is invalid,...
Definition Sema.h:10934
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition SemaAttr.cpp:506
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
virtual void anchor()
This virtual key function only exists to limit the emission of debug info describing the Sema class.
Definition Sema.cpp:259
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition Sema.h:691
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions,...
SimplerImplicitMoveMode
Definition Sema.h:5232
Expr * BuildBuiltinCallExpr(SourceLocation Loc, Builtin::ID Id, MultiExprArg CallArgs)
BuildBuiltinCallExpr - Create a call to a builtin function specified by Id.
StmtResult ActOnOpenMPLoopnest(Stmt *AStmt)
Process a canonical OpenMP loop nest that can either be a canonical literal loop (ForStmt or CXXForRa...
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition SemaAttr.cpp:53
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
ErrorAttr * mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI, StringRef NewUserDiagnostic)
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function.
void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver)
If VD is set but not otherwise used, diagnose, for a parameter or a variable.
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool IsUnevaluatedContext)
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, bool AllowBoolOperation, bool ReportInvalid)
type checking for vector binary operators.
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition Sema.h:4020
void ActOnComment(SourceRange Comment)
Definition Sema.cpp:2395
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
@ Other
C++ [dcl.fct.def.general]p1 function-body: ctor-initializer[opt] compound-statement function-try-bloc...
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition Sema.h:4807
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
Definition SemaStmt.cpp:47
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
OpaquePtr< TemplateName > TemplateTy
Definition Sema.h:399
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition Sema.cpp:1104
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition Sema.h:9498
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement.
FPOptionsOverride CurFPFeatureOverrides()
Definition Sema.h:703
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Given a set of delayed diagnostics, re-emit them as if they had been delayed in the current context i...
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any.
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
StmtResult ActOnOpenMPTaskwaitDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition Sema.h:1199
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef)
Add an init-capture to a lambda scope.
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=std::nullopt)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D)
Check variable declaration in 'omp declare mapper' construct.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
Definition SemaAttr.cpp:735
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, BaseUsingDecl *BUD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void CheckThreadLocalForLargeAlignment(VarDecl *VD)
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
bool IsInsideALocalClassWithinATemplateFunction()
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
void ActOnTranslationUnitScope(Scope *S)
Definition Sema.cpp:127
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
llvm::DenseMap< Decl *, SmallVector< PartialDiagnosticAt, 1 > > SuppressedDiagnosticsMap
For each declaration that involved template argument deduction, the set of diagnostics that were supp...
Definition Sema.h:9567
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, ArrayRef< OMPClause * > ClauseList)
Called on well-formed '#pragma omp requires'.
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType, SourceLocation Loc, const PartialDiagnostic &Diag)
Is the given member accessible for the purposes of deciding whether to define a special member functi...
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=std::nullopt, ArrayRef< DeclGroupPtrTy > allTUVars=std::nullopt)
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
StmtResult BuildIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:952
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
Definition Sema.cpp:1475
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition SemaAttr.cpp:549
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
Definition SemaExpr.cpp:784
LateParsedTemplateMapT LateParsedTemplateMap
Definition Sema.h:939
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition Sema.h:8410
@ CTAK_DeducedFromArrayBound
The template argument was deduced from an array bound via template argument deduction.
Definition Sema.h:8421
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition Sema.h:8413
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
Definition Sema.h:8417
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, const ParsedAttributesView &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S)
isTagName() - This method is called for error recovery purposes only to determine if the specified na...
Definition SemaDecl.cpp:672
void ActOnFinishFunctionDeclarationDeclarator(Declarator &D)
Called after parsing a function declarator belonging to a function declaration.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition SemaAttr.cpp:603
bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old)
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
ExprResult CheckUnevaluatedOperand(Expr *E)
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition Sema.h:1482
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
bool isInOpenMPTaskUntiedContext() const
Return true if currently in OpenMP task with untied clause context.
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition Sema.h:9915
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
StmtResult ActOnOpenMPMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop' after parsing of the associated statement.
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path, ModuleIdPath Partition, ModuleImportState &ImportState)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
bool hasMergedDefinitionInCurrentModule(const NamedDecl *Def)
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
bool IsAllowedCUDACall(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition Sema.h:13249
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy, CastKind &Kind)
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ASTContext & Context
Definition Sema.h:407
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement.
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
Definition Sema.h:13934
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
Definition Sema.cpp:572
bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy)
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
bool DiagIfReachable(SourceLocation Loc, ArrayRef< const Stmt * > Stmts, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the statements's reachability analysis.
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
bool ConstraintExpressionDependsOnEnclosingTemplate(const FunctionDecl *Friend, unsigned TemplateDepth, const Expr *Constraint)
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void ActOnCapturedRegionError()
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
ARCConversionResult
Definition Sema.h:12878
@ ACR_unbridged
Definition Sema.h:12878
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
Definition Sema.h:9926
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition Sema.h:5063
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition SemaAttr.cpp:823
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition Sema.h:9505
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, const OMPVarListLocTy &Locs, OpenMPVarListDataTy &Data)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
DiagnosticsEngine & getDiagnostics() const
Definition Sema.h:1684
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnCXXThis(SourceLocation loc)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2585
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
void resetFPOptions(FPOptions FPO)
Definition Sema.h:727
bool hasAcceptableDefinition(NamedDecl *D, AcceptableKind Kind)
Definition Sema.h:2469
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
DeclResult ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, SourceLocation ImportLoc, ModuleIdPath Path, bool IsPartition=false)
The parser has processed a module import declaration.
Decl * ActOnUsingEnumDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation IdentLoc, IdentifierInfo &II, CXXScopeSpec *SS=nullptr)
bool currentModuleIsInterface() const
Is the module scope we are an interface?
Definition Sema.h:2378
static bool getPrintable(bool B)
Definition Sema.h:2212
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
Definition Sema.cpp:2636
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed '#pragma omp threadprivate'.
void CheckDelayedMemberExceptionSpecs()
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition SemaDecl.cpp:60
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation > > &Functions)
Called on well-formed #pragma alloc_text().
Definition SemaAttr.cpp:787
ClassTemplateDecl * StdCoroutineTraitsCache
The C++ "std::coroutine_traits" template, which is defined in <coroutine_traits>
Definition Sema.h:1180
bool DeclareRISCVSiFiveVectorBuiltins
Indicate RISC-V SiFive vector builtin functions enabled or not.
Definition Sema.h:1654
PragmaStack< bool > StrictGuardStackCheckStack
Definition Sema.h:699
ExprResult ActOnSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
Definition Sema.h:912
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition Sema.h:1208
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
void CleanupVarDeclMarking()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition SemaExpr.cpp:750
ExprResult BuildSourceLocExpr(SourceLocExpr::IdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
bool isImmediateFunctionContext() const
Definition Sema.h:9803
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
ASTContext & getASTContext() const
Definition Sema.h:1687
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
Definition Sema.h:2010
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition SemaExpr.cpp:762
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)
Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...
ExprResult VerifyIntegerConstantExpression(Expr *E, AllowFoldKind CanFold=NoFold)
Definition Sema.h:13061
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>.
Definition Sema.h:1176
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
void CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *MD)
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target update'.
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition Sema.h:5387
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition SemaAttr.cpp:922
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition Sema.h:2668
@ NC_Unknown
This name is not a type or template in this context, but might be something else.
Definition Sema.h:2671
@ NC_VarTemplate
The name was classified as a variable template name.
Definition Sema.h:2698
@ NC_NonType
The name was classified as a specific non-type, non-template declaration.
Definition Sema.h:2681
@ NC_TypeTemplate
The name was classified as a template whose specializations are types.
Definition Sema.h:2696
@ NC_Error
Classification failed; an error has been produced.
Definition Sema.h:2673
@ NC_FunctionTemplate
The name was classified as a function template name.
Definition Sema.h:2700
@ NC_DependentNonType
The name denotes a member of a dependent type that could not be resolved.
Definition Sema.h:2689
@ NC_UndeclaredNonType
The name was classified as an ADL-only function name.
Definition Sema.h:2685
@ NC_UndeclaredTemplate
The name was classified as an ADL-only function template name.
Definition Sema.h:2702
@ NC_Keyword
The name has been typo-corrected to a keyword.
Definition Sema.h:2675
@ NC_Type
The name was classified as a type.
Definition Sema.h:2677
@ NC_OverloadSet
The name was classified as an overload set, and an expression representing that overload set has been...
Definition Sema.h:2694
@ NC_Concept
The name was classified as a concept name.
Definition Sema.h:2704
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N)
PragmaStack< StringLiteral * > ConstSegStack
Definition Sema.h:695
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition SemaAttr.cpp:218
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition SemaExpr.cpp:867
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
void ActOnStartFunctionDeclarationDeclarator(Declarator &D, unsigned TemplateParameterDepth)
Called before parsing a function declarator belonging to a function declaration.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition SemaDecl.cpp:705
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
Definition Sema.h:1067
Decl * ActOnStartHLSLBuffer(Scope *BufferScope, bool CBuffer, SourceLocation KwLoc, IdentifierInfo *Ident, SourceLocation IdentLoc, SourceLocation LBrace)
Definition SemaHLSL.cpp:15
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
ParsingClassState PushParsingClass()
Definition Sema.h:5393
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
Definition Sema.h:904
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
@ FRS_Success
Definition Sema.h:4221
@ FRS_DiagnosticIssued
Definition Sema.h:4223
@ FRS_NoViableFunction
Definition Sema.h:4222
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition SemaAttr.cpp:111
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
StmtResult ActOnOpenMPParallelMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop' after parsing of the associated statemen...
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, std::optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition Sema.h:9918
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
Definition Sema.h:1586
@ Relational
This is an <, <=, >, or >= that should be implemented as a rewrite in terms of a <=> comparison.
@ NotEqual
This is an operator!= that should be implemented as a rewrite in terms of a == comparison.
@ ThreeWay
This is an operator<=> that should be implemented as a series of subobject comparisons.
@ None
This is not a defaultable comparison operator.
@ Equal
This is an operator== that should be implemented as a series of subobject comparisons.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, const SourceRange &, DeclAccessPair FoundDecl)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized.
Definition Sema.h:1611
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
IsPointerConversion - Determines whether the conversion of the expression From, which has the (possib...
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr, TemplateSpecCandidateSet *FailedTSC=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
AllowedExplicit
Definition Sema.h:3809
@ Conversions
Allow explicit conversion functions but not explicit constructors.
@ All
Allow both explicit conversion functions and explicit constructors.
void ActOnFinishRequiresExpr()
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
Definition Sema.h:395
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition Sema.h:938
void ProcessPragmaWeak(Scope *S, Decl *D)
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation, bool IsUsingIfExists)
Builds a using declaration.
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Definition Sema.h:3296
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
Decl * BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record, const PrintingPolicy &Policy)
BuildAnonymousStructOrUnion - Handle the declaration of an anonymous structure or union.
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr, bool Reversed=false)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their param...
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
Definition SemaAttr.cpp:522
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
Definition Sema.h:2389
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition Sema.cpp:1480
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
OMPClause * ActOnOpenMPAtClause(OpenMPAtClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'at' clause.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition Sema.cpp:2386
unsigned InventedParameterInfosStart
The index of the first InventedParameterInfo that refers to the current context.
Definition Sema.h:844
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel master' after parsing of the associated statement.
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, std::optional< CXXRecordDecl::LambdaNumbering > NumberingOverride=std::nullopt)
Number lambda for linkage purposes if necessary.
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=std::nullopt)
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition Sema.h:1496
void setFunctionHasIndirectGoto()
Definition Sema.cpp:2307
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
bool checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal, bool &HasDefault, bool &HasCommas, bool &HasNotDefault, SmallVectorImpl< SmallString< 64 > > &StringsBuffer)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition Sema.h:8494
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition Sema.h:8512
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
Definition Sema.h:8523
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
Definition Sema.h:8502
@ TPL_TemplateParamsEquivalent
We are determining whether the template-parameters are equivalent according to C++ [temp....
Definition Sema.h:8533
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition Sema.h:2062
EnumDecl * getStdAlignValT() const
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
Definition Sema.cpp:1494
QualType BuiltinRemoveReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition Sema.h:1168
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'reduction' clause.
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition SemaAttr.cpp:273
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
AssumedTemplateKind
Definition Sema.h:8096
@ FoundFunctions
This is assumed to be a template name because lookup found one or more functions (but no function tem...
@ FoundNothing
This is assumed to be a template name because lookup found nothing.
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition SemaAttr.cpp:681
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld)
MergeVarDeclTypes - We parsed a variable 'New' which has the same name and scope as a previous declar...
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared.
Definition Sema.h:1143
ExprResult ActOnUnevaluatedStringLiteral(ArrayRef< Token > StringToks)
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition Sema.h:1202
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind)
Called on correct id-expression from the '#pragma omp threadprivate'.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
OMPClause * ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
bool isSameOrCompatibleFunctionType(QualType Param, QualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment,...
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
AtomicArgumentOrder
Definition Sema.h:5939
void PushFunctionScope()
Enter a new function scope.
Definition Sema.cpp:2127
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:387
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition Sema.cpp:1500
SourceRange getExprRange(Expr *E) const
Definition SemaExpr.cpp:507
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
FunctionTemplateDecl * DeclareImplicitDeductionGuideFromInitList(TemplateDecl *Template, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc)
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
void PrintPragmaAttributeInstantiationPoint()
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
Definition Sema.h:846
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition SemaAttr.cpp:167
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
void LateTemplateParserCleanupCB(void *P)
Definition Sema.h:943
std::optional< ExpressionEvaluationContextRecord::InitializationContext > OutermostDeclarationWithDelayedImmediateInvocations() const
Definition Sema.h:9834
static DeclarationName getPrintable(DeclarationName N)
Definition Sema.h:2219
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
bool FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD)
void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
Definition SemaStmt.cpp:220
FPOptions & getCurFPFeatures()
Definition Sema.h:1682
RecordDecl * StdSourceLocationImplDecl
The C++ "std::source_location::__impl" struct, defined in <source_location>.
Definition Sema.h:1187
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition Sema.h:948
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition Sema.cpp:58
sema::LambdaScopeInfo * PushLambdaScope()
Definition Sema.cpp:2145
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
StmtResult ActOnOpenMPInteropDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp interop'.
void PopCompoundScope()
Definition Sema.cpp:2284
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2539
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, const MultiLevelTemplateArgumentList &TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
bool isObjCMethodDecl(Decl *D)
Definition Sema.h:3124
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition Sema.h:8687
@ UPPC_FixedUnderlyingType
The fixed underlying type of an enumeration.
Definition Sema.h:8707
@ UPPC_RequiresClause
Definition Sema.h:8755
@ UPPC_UsingDeclaration
A using declaration.
Definition Sema.h:8713
@ UPPC_IfExists
Microsoft __if_exists.
Definition Sema.h:8737
@ UPPC_Requirement
Definition Sema.h:8752
@ UPPC_ExceptionType
The type of an exception.
Definition Sema.h:8731
@ UPPC_EnumeratorValue
The enumerator value.
Definition Sema.h:8710
@ UPPC_Lambda
Lambda expression.
Definition Sema.h:8743
@ UPPC_IfNotExists
Microsoft __if_not_exists.
Definition Sema.h:8740
@ UPPC_PartialSpecialization
Partial specialization.
Definition Sema.h:8734
@ UPPC_Initializer
An initializer.
Definition Sema.h:8722
@ UPPC_BaseType
The base type of a class type.
Definition Sema.h:8692
@ UPPC_FriendDeclaration
A friend declaration.
Definition Sema.h:8716
@ UPPC_DefaultArgument
A default argument.
Definition Sema.h:8725
@ UPPC_DeclarationType
The type of an arbitrary declaration.
Definition Sema.h:8695
@ UPPC_Expression
An arbitrary expression.
Definition Sema.h:8689
@ UPPC_DeclarationQualifier
A declaration qualifier.
Definition Sema.h:8719
@ UPPC_DataMemberType
The type of a data member.
Definition Sema.h:8698
@ UPPC_StaticAssertExpression
The expression in a static assertion.
Definition Sema.h:8704
@ UPPC_Block
Block expression.
Definition Sema.h:8746
@ UPPC_BitFieldWidth
The size of a bit-field.
Definition Sema.h:8701
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
Definition Sema.h:8728
@ UPPC_TypeConstraint
A type constraint.
Definition Sema.h:8749
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition Sema.h:1217
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Definition SemaExpr.cpp:416
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UsingDecl, bool IsNested)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
OMPClause * ActOnOpenMPXDynCGroupMemClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'ompx_dyn_cgroup_mem' clause.
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool Mutable)
Endow the lambda scope info with the relevant properties.
const LangOptions & getLangOpts() const
Definition Sema.h:1680
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
ExprResult BuildSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void DiagnoseInvalidJumps(Stmt *Body)
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
OMPClause * ActOnOpenMPSeverityClause(OpenMPSeverityClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'severity' clause.
OMPClause * ActOnOpenMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acquire' clause.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition Sema.h:7724
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
AccessResult CheckStructuredBindingMemberAccess(SourceLocation UseLoc, CXXRecordDecl *DecomposedClass, DeclAccessPair Field)
Checks implicit access to a member in a structured binding.
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
SourceLocation CurInitSegLoc
Definition Sema.h:750
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition SemaAttr.cpp:610
bool currentModuleIsHeaderUnit() const
Is the module scope we are in a C++ Header Unit?
Definition Sema.h:2383
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, const DeclSpec &DS)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
void SwapSatisfactionStack(llvm::SmallVectorImpl< SatisfactionStackEntryTy > &NewSS)
Definition Sema.h:7413
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
ReuseLambdaContextDecl_t
Definition Sema.h:5450
@ ReuseLambdaContextDecl
Definition Sema.h:5450
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
bool tryToFixVariablyModifiedVarType(TypeSourceInfo *&TInfo, QualType &T, SourceLocation Loc, unsigned FailedFoldDiagID)
Attempt to fold a variable-sized type to a constant-sized type, returning true if we were successful.
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
void MarkExpressionAsImmediateEscalating(Expr *E)
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old)
We've determined that New is a redeclaration of Old.
bool TemplateParameterListsAreEqual(const NamedDecl *NewInstFrom, TemplateParameterList *New, const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void ActOnLambdaClosureParameters(Scope *LambdaScope, MutableArrayRef< DeclaratorChunk::ParamInfo > ParamInfo)
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
void ActOnOpenMPIteratorVarDecl(VarDecl *VD)
ASTConsumer & getASTConsumer() const
Definition Sema.h:1688
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules,...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
void * OpaqueParser
Definition Sema.h:946
LazyVector< VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition Sema.h:898
Preprocessor & PP
Definition Sema.h:406
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult BuildSynthesizedThreeWayComparison(SourceLocation OpLoc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, FunctionDecl *DefaultedFn)
QualType BuiltinEnumUnderlyingType(QualType BaseType, SourceLocation Loc)
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
OMPClause * ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acq_rel' clause.
StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop simd' after parsing of the associated sta...
bool MSPragmaOptimizeIsOn
The "on" or "off" argument passed by #pragma optimize, that denotes whether the optimizations in the ...
Definition Sema.h:791
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Decl *D, SmallVectorImpl< FunctionDecl * > &Bases)
Register D as specialization of all base functions in Bases in the current omp begin/end declare vari...
bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty, SourceLocation OpLoc, SourceRange R)
ActOnAlignasTypeArgument - Handle alignas(type-id) and _Alignas(type-name) .
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition Sema.h:9930
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition Sema.h:775
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
ExprResult BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
ExprResult VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind, bool StrictlyPositive=true, bool SuppressExprDiags=false)
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void updateOutOfDateSelector(Selector Sel)
bool areMatrixTypesOfTheSameDimension(QualType srcTy, QualType destTy)
Are the two types matrix types and do they have the same dimensions i.e.
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition Sema.cpp:629
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition Sema.h:1205
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
Definition Sema.h:7456
const LangOptions & LangOpts
Definition Sema.h:405
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition Sema.h:9940
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:5015
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
TemplateDeductionResult
Describes the result of template argument deduction.
Definition Sema.h:9051
@ TDK_InvalidExplicitArguments
The explicitly-specified template arguments were not valid template arguments for the given template.
Definition Sema.h:9094
@ TDK_Invalid
The declaration was invalid; do nothing.
Definition Sema.h:9055
@ TDK_InstantiationDepth
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition Sema.h:9058
@ TDK_Success
Template argument deduction was successful.
Definition Sema.h:9053
@ TDK_MiscellaneousDeductionFailure
Deduction failed; that's all we know.
Definition Sema.h:9101
@ TDK_ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
Definition Sema.h:9099
@ TDK_NonDependentConversionFailure
Checking non-dependent argument conversions failed.
Definition Sema.h:9096
@ TDK_TooFewArguments
When performing template argument deduction for a function template, there were too few call argument...
Definition Sema.h:9091
@ TDK_Incomplete
Template argument deduction did not deduce a value for every template parameter.
Definition Sema.h:9061
@ TDK_CUDATargetMismatch
CUDA Target attributes do not match.
Definition Sema.h:9103
@ TDK_DeducedMismatchNested
After substituting deduced template arguments, an element of a dependent parameter type did not match...
Definition Sema.h:9082
@ TDK_AlreadyDiagnosed
Some error which was already diagnosed.
Definition Sema.h:9105
@ TDK_DeducedMismatch
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
Definition Sema.h:9078
@ TDK_Inconsistent
Template argument deduction produced inconsistent deduced values for the given template parameter.
Definition Sema.h:9067
@ TDK_NonDeducedMismatch
A non-depnedent component of the parameter did not match the corresponding component of the argument.
Definition Sema.h:9085
@ TDK_TooManyArguments
When performing template argument deduction for a function template, there were too many call argumen...
Definition Sema.h:9088
@ TDK_IncompletePack
Template argument deduction did not deduce a value for every expansion of an expanded template parame...
Definition Sema.h:9064
@ TDK_Underqualified
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition Sema.h:9072
@ TDK_SubstitutionFailure
Substitution of the deduced template argument values resulted in an error.
Definition Sema.h:9075
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly=false)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From,...
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
Definition Sema.h:817
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Definition Sema.h:4623
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition Sema.cpp:2361
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
static const uint64_t MaximumAlignment
Definition Sema.h:396
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition Sema.h:4992
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
llvm::DenseMap< unsigned, CXXDeductionGuideDecl * > AggregateDeductionCandidates
Definition Sema.h:9217
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition Sema.h:436
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=std::nullopt, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
Definition Sema.h:934
void ActOnStartOfCompoundStmt(bool IsStmtExpr)
Definition SemaStmt.cpp:390
bool isReachable(const NamedDecl *D)
Determine whether a declaration is reachable.
Definition Sema.h:2412
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition Sema.h:867
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition Sema.h:413
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
Definition Sema.cpp:1036
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization, bool DeclIsDefn)
Perform semantic checking of a new function declaration.
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
ObjCLiteralKind
Definition Sema.h:4002
@ LK_Dictionary
Definition Sema.h:4004
@ LK_String
Definition Sema.h:4007
@ LK_Numeric
Definition Sema.h:4005
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst)
Update instantiation attributes after template was late parsed.
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
PragmaClangSection PragmaClangRelroSection
Definition Sema.h:471
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
LazyVector< TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition Sema.h:854
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, QualType BaseType)
Checks access to Target from the given class.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition Sema.h:439
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
Definition Sema.h:7730
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *RetExpr, const AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec....
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition SemaExpr.cpp:200
void CheckCXXDefaultArguments(FunctionDecl *FD)
CheckCXXDefaultArguments - Verify that the default arguments for a function declaration are well-form...
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition Sema.h:1154
ComparisonCategoryUsage
Definition Sema.h:6185
@ OperatorInExpression
The '<=>' operator was used in an expression and a builtin operator was selected.
@ DefaultedOperator
A defaulted 'operator<=>' needed the comparison category.
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
Definition Sema.h:9948
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
Definition Sema.h:840
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition SemaExpr.cpp:67
bool isInOpenMPAssumeScope() const
Check if there is an active global omp begin assumes directive.
Definition Sema.h:11313
void startOpenMPCXXRangeFor()
If the current region is a range loop-based region, mark the start of the loop construct.
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition Sema.h:1193
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level)
Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.) for FD based on DSA for the...
WebAssemblyImportModuleAttr * mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL)
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
static StringRef getPrintable(StringRef S)
Definition Sema.h:2214
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
NamedDecl * BuildUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation NameLoc, TypeSourceInfo *EnumType, EnumDecl *ED)
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
PragmaStack< AlignPackInfo > AlignPackStack
Definition Sema.h:684
StmtResult ActOnOpenMPMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop simd' after parsing of the associated statement.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
bool canDelayFunctionBody(const Declarator &D)
Determine whether we can delay parsing the body of a function or function template until it is used,...
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition Sema.h:803
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
Definition Sema.h:9530
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition Sema.h:1512
StmtResult ActOnExprStmtError()
Definition SemaStmt.cpp:64
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
PragmaStack< StringLiteral * > BSSSegStack
Definition Sema.h:694
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed.
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
void completeExprArrayBound(Expr *E)
DeclContext * getCurLexicalContext() const
Definition Sema.h:13913
ExprResult BuildConvertedConstantExpression(Expr *From, QualType T, CCEKind CCE, NamedDecl *Dest=nullptr)
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
Definition Sema.h:753
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
Definition Sema.cpp:1487
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition Sema.h:1499
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool UseMemberUsingDeclRules)
Determine whether the given New declaration is an overload of the declarations in Old.
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
bool hasExplicitCallingConv(QualType T)
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, CorrectionCandidateCallback *CCC=nullptr)
Perform name lookup on the given name, classifying it based on the results of name lookup and the fol...
Definition SemaDecl.cpp:900
OpaquePtr< QualType > TypeTy
Definition Sema.h:400
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition Sema.h:1211
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition SemaStmt.cpp:69
OpenCLOptions OpenCLFeatures
Definition Sema.h:402
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
bool CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, SourceLocation DefaultLoc)
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
Decl * ActOnConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr)
SmallVector< std::deque< PendingImplicitInstantiation >, 8 > SavedPendingInstantiations
Definition Sema.h:9952
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition SemaExpr.cpp:932
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
Definition Sema.h:794
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
void ExitDeclaratorContext(Scope *S)
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition Sema.h:11417
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, OMPDeclareTargetDeclAttr::MapTypeTy MT, DeclareTargetContextInfo &DTCI)
Called on correct id-expression from the '#pragma omp declare target'.
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition Sema.cpp:710
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'in_reduction' clause.
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition SemaAttr.cpp:851
bool buildCoroutineParameterMoves(SourceLocation Loc)
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition Sema.h:11316
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted)
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition Sema.h:746
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop simd' after parsing of the associated statement.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, const ParsedAttributesView &Attrs, SourceLocation EqualLoc, Expr *Val)
sema::FunctionScopeInfo * getCurFunction() const
Definition Sema.h:2018
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
void PushCompoundScope(bool IsStmtExpr)
Definition Sema.cpp:2279
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
ProcessingContextState ParsingClassState
Definition Sema.h:5392
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel sections' after parsing of the associated statement.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
FunctionDecl * CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID, SourceLocation Loc)
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
bool isDeclaratorFunctionLike(Declarator &D)
Determine whether.
Definition Sema.cpp:2723
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent)
Determine whether it's plausible that E was intended to be a template-name.
Definition Sema.h:2882
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
std::optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, ArithConvKind OperationKind)
bool CheckNontrivialField(FieldDecl *FD)
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
HLSLNumThreadsAttr * mergeHLSLNumThreadsAttr(Decl *D, const AttributeCommonInfo &AL, int X, int Y, int Z)
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
llvm::DenseMap< const VarDecl *, int > RefsMinusAssignments
Increment when we find a reference; decrement when we find an ignored assignment.
Definition Sema.h:1648
ExprResult ActOnFinishTrailingRequiresClause(ExprResult ConstraintExpr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
ExprResult PerformQualificationConversion(Expr *E, QualType Ty, ExprValueKind VK=VK_PRValue, CheckedConversionKind CCK=CCK_ImplicitConversion)
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, bool IsAbstract, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition Sema.h:4445
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
Definition Sema.cpp:2080
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
bool isConstantEvaluated() const
Definition Sema.h:1069
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition Sema.h:1508
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body,...
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
StmtResult ActOnOpenMPParallelMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop simd' after parsing of the associated sta...
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition Sema.h:13944
void MarkThisReferenced(CXXThisExpr *This)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
std::optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody)
Warn if a for/while loop statement S, which is followed by PossibleBody, has a suspicious null statem...
ExprResult DefaultLvalueConversion(Expr *E)
Definition SemaExpr.cpp:640
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition Sema.h:9538
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition Sema.h:2406
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< OMPInteropInfo > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition Sema.h:749
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
Definition Sema.h:2373
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so,...
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition Sema.h:1235
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
StmtResult ActOnOpenMPUnrollDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp unroll' after parsing of its clauses and the associated statement.
static bool isCast(CheckedConversionKind CCK)
Definition Sema.h:12361
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ControllingExprOrType is either an opaque pointer coming out of a ParsedType or an Expr *.
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
void NoteOverloadCandidate(const NamedDecl *Found, const FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition Sema.cpp:2317
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
bool DiagnoseUseOfOverloadedDecl(NamedDecl *D, SourceLocation Loc)
Definition Sema.h:5425
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition Sema.h:887
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
FunctionDecl * resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition Sema.h:419
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition Sema.h:4389
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
Definition Sema.h:4392
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition Sema.h:4395
@ ForExternalRedeclaration
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Definition Sema.h:4399
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
llvm::PointerIntPair< CXXRecordDecl *, 3, CXXSpecialMember > SpecialMemberDecl
Definition Sema.h:1578
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true, bool WantSize=false, bool WantAligned=false)
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type, bool IsDeclareSimd=false)
Checks that the specified declaration matches requirements for the linear decls.
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
Definition SemaCast.cpp:278
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
DeclGroupPtrTy ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, SourceLocation PrivateLoc)
The parser has processed a private-module-fragment declaration that begins the definition of the priv...
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition Sema.h:9568
@ VAK_Invalid
Definition Sema.h:12437
@ VAK_ValidInCXX11
Definition Sema.h:12434
@ VAK_MSVCUndefined
Definition Sema.h:12436
@ VAK_Undefined
Definition Sema.h:12435
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition Sema.h:10012
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc)
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition SemaAttr.cpp:502
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition Sema.h:10807
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition SemaAttr.cpp:778
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
static SourceRange getPrintable(TypeLoc TL)
Definition Sema.h:2224
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation(), bool ForOverloadResolution=false)
Check whether the given function decl's trailing requires clause is satisfied, if any.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
QualType QIDNSCopying
id<NSCopying> type.
Definition Sema.h:1232
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
TrivialABIHandling
Definition Sema.h:3421
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
Definition Sema.h:3423
@ TAH_ConsiderTrivialABI
The triviality of a method affected by "trivial_abi".
Definition Sema.h:3426
FormatArgumentPassingKind
Definition Sema.h:13543
@ FAPK_Variadic
Definition Sema.h:13545
@ FAPK_VAList
Definition Sema.h:13546
void FillInlineAsmIdentifierInfo(Expr *Res, llvm::InlineAsmIdentifierInfo &Info)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
Definition Sema.h:9791
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
Definition Sema.cpp:1455
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, NamedReturnInfo &NRInfo, bool SupressSimplerImplicitMoves)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes.
MethodMatchStrategy
Definition Sema.h:4904
@ MMS_strict
Definition Sema.h:4906
@ MMS_loose
Definition Sema.h:4905
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
OMPClause * ActOnOpenMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'release' clause.
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition Sema.h:10197
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
Definition Sema.h:445
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition Sema.h:12504
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition Sema.h:12548
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
Definition Sema.h:12514
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition Sema.h:12572
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition Sema.h:12577
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
Definition Sema.h:12564
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition Sema.h:12543
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
Definition Sema.h:12522
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
Definition Sema.h:12581
@ Compatible
Compatible - the types are compatible according to the standard.
Definition Sema.h:12506
@ IncompatibleFunctionPointerStrict
IncompatibleFunctionPointerStrict - The assignment is between two function pointer types that are not...
Definition Sema.h:12533
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
Definition Sema.h:12585
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition Sema.h:12518
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
Definition Sema.h:12527
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition Sema.h:12539
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
Definition Sema.h:12560
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
Definition Sema.h:12554
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
Definition Sema.h:12510
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition Sema.h:12568
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
void MarkVirtualBaseDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl, llvm::SmallPtrSetImpl< const RecordType * > *DirectVirtualBases=nullptr)
Mark destructors of virtual bases of this class referenced.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
ParserCompletionContext
Describes the context in which code completion occurs.
Definition Sema.h:13343
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition Sema.h:13377
@ PCC_Template
Code completion occurs following one or more template headers.
Definition Sema.h:13359
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
Definition Sema.h:13362
@ PCC_Expression
Code completion occurs within an expression.
Definition Sema.h:13364
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
Definition Sema.h:13350
@ PCC_Class
Code completion occurs within a class, struct, or union.
Definition Sema.h:13347
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
Definition Sema.h:13353
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition Sema.h:13382
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
Definition Sema.h:13345
@ PCC_Type
Code completion occurs where only a type is permitted.
Definition Sema.h:13379
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition Sema.h:13373
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition Sema.h:13370
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition Sema.h:13367
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
Definition Sema.h:13356
void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD)
Check that the C++ class annoated with "trivial_abi" satisfies all the conditions that are needed for...
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnCapturedRegionEnd(Stmt *S)
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
Definition Sema.h:12478
@ ACK_Arithmetic
An arithmetic operation.
Definition Sema.h:12480
@ ACK_CompAssign
A compound assignment expression.
Definition Sema.h:12488
@ ACK_BitwiseOp
A bitwise operation.
Definition Sema.h:12482
@ ACK_Conditional
A conditional (?:) operator.
Definition Sema.h:12486
@ ACK_Comparison
A comparison.
Definition Sema.h:12484
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp critical' after parsing of the associated statement.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
Definition Sema.h:2419
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
QualType getDecltypeForExpr(Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II, SourceLocation Loc)
DeclClonePragmaWeak - clone existing decl (maybe definition), #pragma weak needs a non-definition dec...
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
StmtResult ActOnOpenMPParallelMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel masked' after parsing of the associated statement.
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool CheckTypeConstraint(TemplateIdAnnotation *TypeConstraint)
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition Sema.h:11171
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
bool isKnownName(StringRef name)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
Definition Sema.h:1239
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition Sema.h:423
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
Definition Sema.h:1293
bool MSStructPragmaOn
Definition Sema.h:429
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
ExprResult TransformToPotentiallyEvaluated(Expr *E)
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
unsigned ActOnReenterTemplateScope(Decl *Template, llvm::function_ref< Scope *()> EnterScope)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
StmtResult ActOnOpenMPMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp masked' after parsing of the.
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore,...
Definition Sema.h:9514
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
CheckedConversionKind
The kind of conversion being performed.
Definition Sema.h:12348
@ CCK_OtherCast
A cast other than a C-style cast.
Definition Sema.h:12356
@ CCK_ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
Definition Sema.h:12358
@ CCK_CStyleCast
A C-style cast.
Definition Sema.h:12352
@ CCK_ImplicitConversion
An implicit conversion.
Definition Sema.h:12350
@ CCK_FunctionalCast
A functional-style cast.
Definition Sema.h:12354
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition Sema.h:1555
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, QualType NewT, QualType OldT)
Determines if we can perform a correct type check for D as a redeclaration of PrevDecl.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
ExprResult CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, NestedNameSpecifierLoc NNSLoc, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL=true)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition Sema.h:9762
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition Sema.h:3327
@ NTK_Typedef
Definition Sema.h:3332
@ NTK_NonUnion
Definition Sema.h:3330
@ NTK_TypeAlias
Definition Sema.h:3333
@ NTK_NonClass
Definition Sema.h:3329
@ NTK_NonEnum
Definition Sema.h:3331
@ NTK_NonStruct
Definition Sema.h:3328
@ NTK_TemplateTemplateArgument
Definition Sema.h:3336
@ NTK_TypeAliasTemplate
Definition Sema.h:3335
@ NTK_Template
Definition Sema.h:3334
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID)
Definition Sema.h:2534
void ActOnObjCContainerFinishDefinition()
void ActOnOpenMPEndDeclareVariant()
Handle a omp end declare variant.
SourceManager & getSourceManager() const
Definition Sema.h:1685
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
@ TryCapture_Implicit
Definition Sema.h:5494
@ TryCapture_ExplicitByVal
Definition Sema.h:5494
@ TryCapture_ExplicitByRef
Definition Sema.h:5494
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement.
QualType BuiltinAddReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition Sema.h:6719
AssignmentAction
Definition Sema.h:3748
@ AA_Returning
Definition Sema.h:3751
@ AA_Passing_CFAudited
Definition Sema.h:3756
@ AA_Initializing
Definition Sema.h:3753
@ AA_Converting
Definition Sema.h:3752
@ AA_Assigning
Definition Sema.h:3749
@ AA_Passing
Definition Sema.h:3750
@ AA_Casting
Definition Sema.h:3755
@ AA_Sending
Definition Sema.h:3754
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
CallingConventionIgnoredReason
Describes the reason a calling convention specification was ignored, used for diagnostics.
Definition Sema.h:14025
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition Sema.cpp:519
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
Definition Sema.h:7720
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCUDACall has emitted a (maybe deferred) "bad call" d...
Definition Sema.h:13103
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, Scope *S, bool MergeTypeWithOld)
Completes the merge of two function declarations that are known to be compatible.
bool hasVisibleMergedDefinition(const NamedDecl *Def)
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition Sema.cpp:807
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
ClassTemplateDecl * lookupCoroutineTraits(SourceLocation KwLoc, SourceLocation FuncLoc)
Lookup 'coroutine_traits' in std namespace and std::experimental namespace.
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Definition Sema.h:8542
OMPClause * ActOnOpenMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'compare' clause.
bool areMultiversionVariantFunctionsCompatible(const FunctionDecl *OldFD, const FunctionDecl *NewFD, const PartialDiagnostic &NoProtoDiagID, const PartialDiagnosticAt &NoteCausedDiagIDAt, const PartialDiagnosticAt &NoSupportDiagIDAt, const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported, bool ConstexprSupported, bool CLinkageMayDiffer)
Checks if the variant/multiversion functions are compatible.
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)
Perform the initialization of a potentially-movable value, which is the result of return value.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD, DefaultedComparisonKind DCK)
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition Sema.h:1220
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg)
Check a template argument against its corresponding template template parameter.
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init, ParenListExpr *PL=nullptr)
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition Sema.h:1478
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType, BinaryOperatorKind Opc)
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition SemaAttr.cpp:436
RedeclarationKind forRedeclarationInCurContext() const
Definition Sema.h:4402
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification,...
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e....
void FilterUsingLookup(Scope *S, LookupResult &lookup)
Remove decls we can't actually see from a lookup being used to declare shadow using decls.
ExprResult ActOnSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
CanThrowResult canThrow(const Stmt *E)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
StmtResult ActOnOpenMPTargetParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel loop' after parsing of the associated statement.
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Definition Sema.h:8021
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
void ActOnFinishHLSLBuffer(Decl *Dcl, SourceLocation RBrace)
Definition SemaHLSL.cpp:30
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
PragmaClangSection PragmaClangTextSection
Definition Sema.h:472
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
NonTrivialCUnionKind
Definition Sema.h:3060
@ NTCUK_Destruct
Definition Sema.h:3062
@ NTCUK_Init
Definition Sema.h:3061
@ NTCUK_Copy
Definition Sema.h:3063
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
PragmaClangSection PragmaClangDataSection
Definition Sema.h:469
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, SmallVectorImpl< FunctionDecl * > &Bases)
The declarator D defines a function in the scope S which is nested in an omp begin/end declare varian...
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
Definition Sema.h:7195
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=std::nullopt, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
OMPClause * ActOnOpenMPWhenClause(OMPTraitInfo &TI, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'when' clause.
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool anyAltivecTypes(QualType srcType, QualType destType)
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
TypeSourceInfo * SubstAutoTypeSourceInfoDependent(TypeSourceInfo *TypeWithAuto)
void * SkippedDefinitionContext
Definition Sema.h:3513
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, SourceLocation AsmLoc)
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition Sema.cpp:2139
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef< const Expr * > AC1, NamedDecl *D2, MutableArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
sema::FunctionScopeInfo * getCurFunctionAvailabilityContext()
Retrieve the current function, if any, that should be analyzed for potential availability violations.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
void ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname.
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition Sema.h:11455
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition Sema.h:683
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition SemaAttr.cpp:89
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition Sema.h:4997
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraints=true)
MaybeODRUseExprSet MaybeODRUseExprs
Definition Sema.h:815
void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro, SourceLocation MutableLoc)
ExternalSemaSource * getExternalSource() const
Definition Sema.h:1690
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
unsigned FunctionScopesStart
The index of the first FunctionScope that corresponds to the current context.
Definition Sema.h:825
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition Sema.h:756
NamedDecl * lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id)
Searches for the provided declaration name for OpenMP declare target directive.
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition Sema.h:12733
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
Definition SemaExpr.cpp:223
static SourceRange getPrintable(SourceRange R)
Definition Sema.h:2221
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI)
Handle a omp begin declare variant.
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
void PushSatisfactionStackEntry(const NamedDecl *D, const llvm::FoldingSetNodeID &ID)
Definition Sema.h:7379
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc, ImplicitTypenameContext IsImplicitTypename=ImplicitTypenameContext::No)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
Definition Sema.h:2521
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, const PartialDiagnostic &PD, const FunctionDecl *FD=nullptr)
Definition Sema.h:13178
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Definition Sema.cpp:2687
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition Sema.h:13839
bool CheckImmediateEscalatingFunctionDefinition(FunctionDecl *FD, const sema::FunctionScopeInfo *FSI)
void emitDeferredDiags()
Definition Sema.cpp:1793
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
void setFunctionHasMustTail()
Definition Sema.cpp:2312
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration,...
bool WarnedStackExhausted
Definition Sema.h:1643
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition Sema.h:1183
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
CorrectTypoKind
Definition Sema.h:4575
@ CTK_NonError
Definition Sema.h:4576
@ CTK_ErrorRecovery
Definition Sema.h:4577
void CheckCompleteVariableDeclaration(VarDecl *VD)
bool CanPerformAggregateInitializationForOverloadResolution(const InitializedEntity &Entity, InitListExpr *From)
Determine whether we can perform aggregate initialization for the purposes of overload resolution.
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
@ Global
The global module fragment, between 'module;' and a module-declaration.
Definition Sema.h:1969
@ Normal
A normal translation unit fragment.
Definition Sema.h:1973
void PopSatisfactionStackEntry()
Definition Sema.h:7385
void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL,...
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
void setFunctionHasBranchProtectedScope()
Definition Sema.cpp:2302
bool hasReachableDefinition(NamedDecl *D)
Definition Sema.h:2461
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
bool isConstantEvaluatedContext() const
Definition Sema.h:9797
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition Sema.h:1164
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
DelayedDiagnosticsState ParsingDeclState
Definition Sema.h:962
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition SemaDecl.cpp:619
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind)
bool DeclareRISCVVBuiltins
Indicate RISC-V vector builtin functions enabled or not.
Definition Sema.h:1651
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
bool SubstDefaultArgument(SourceLocation Loc, ParmVarDecl *Param, const MultiLevelTemplateArgumentList &TemplateArgs, bool ForCallExpr=false)
Substitute the given template arguments into the default argument.
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
QualType BuiltinAddPointer(QualType BaseType, SourceLocation Loc)
bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called on the start of target region i.e. '#pragma omp declare target'.
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective()
Called at the end of target region i.e. '#pragma omp end declare target'.
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition Sema.cpp:1030
CCEKind
Contexts in which a converted constant expression is required.
Definition Sema.h:3892
@ CCEK_StaticAssertMessageSize
Call to size() in a static assert message.
Definition Sema.h:3899
@ CCEK_ExplicitBool
Condition in an explicit(bool) specifier.
Definition Sema.h:3897
@ CCEK_Noexcept
Condition in a noexcept(bool) specifier.
Definition Sema.h:3898
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
Definition Sema.h:3896
@ CCEK_CaseValue
Expression in a case label.
Definition Sema.h:3893
@ CCEK_TemplateArg
Value of a non-type template parameter.
Definition Sema.h:3895
@ CCEK_StaticAssertMessageData
Call to data() in a static assert message.
Definition Sema.h:3901
@ CCEK_Enumerator
Enumerator value with fixed underlying type.
Definition Sema.h:3894
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, unsigned NumCallArguments2, bool Reversed=false)
Returns the more specialized function template according to the rules of function template partial or...
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
CUDAVariableTarget
Definition Sema.h:13205
@ CVT_Both
Emitted on host side only.
Definition Sema.h:13208
@ CVT_Unified
Emitted on both sides with different addresses.
Definition Sema.h:13209
@ CVT_Host
Emitted on device side with a shadow variable on host side.
Definition Sema.h:13207
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnOpenMPDispatchDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp dispatch' after parsing of the.
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'to' clause.
CUDAFunctionTarget
Definition Sema.h:13188
@ CFT_HostDevice
Definition Sema.h:13192
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
Definition SemaDecl.cpp:329
ExprResult SubstConstraintExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
OMPClause * ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind)
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be provided to the given template, converting the argumen...
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
bool isInOpenMPTargetExecutionDirective() const
Return true inside OpenMP target region.
ASTConsumer & Consumer
Definition Sema.h:408
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
const DeclContext * getCurObjCLexicalContext() const
Definition Sema.h:13917
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
OverloadKind
C++ Overloading.
Definition Sema.h:3760
@ Ovl_NonFunction
This is not an overload because the lookup results contain a non-function.
Definition Sema.h:3771
@ Ovl_Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition Sema.h:3763
@ Ovl_Match
This is not an overload because the signature exactly matches an existing declaration.
Definition Sema.h:3767
PragmaAlignPackDiagnoseKind
Definition Sema.h:10727
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=std::nullopt)
Called on well-formed 'task_reduction' clause.
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition Sema.h:807
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition SemaExpr.cpp:116
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition Sema.h:9929
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
Definition Sema.cpp:1603
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
Definition Sema.h:9944
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
ModuleImportState
An enumeration to represent the transition of states in parsing module fragments and imports.
Definition Sema.h:3193
@ PrivateFragmentImportFinished
after 'module :private;' but a non-import decl has already been seen.
@ ImportFinished
after any non-import decl.
@ PrivateFragmentImportAllowed
after 'module :private;' but before any non-import decl.
@ FirstDecl
Parsing the first decl in a TU.
@ GlobalFragment
after 'module;' but before 'module X;'
@ NotACXX20Module
Not a C++20 TU, or an invalid state was found.
@ ImportAllowed
after 'module X;' but before any non-import decl.
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
StmtResult ActOnOpenMPTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams loop' after parsing of the associated statement.
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
static QualType getPrintable(QualType T)
Definition Sema.h:2220
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
QualType GetSignedVectorType(QualType V)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition Sema.cpp:62
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
OMPClause * ActOnOpenMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'atomic_default_mem_order' clause.
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void incrementMSManglingNumber() const
Definition Sema.h:13905
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void AddNonMemberOperatorCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
Add all of the non-member operator function declarations in the given function set to the overload ca...
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool inferObjCARCLifetime(ValueDecl *decl)
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
Definition Sema.h:1243
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void ActOnOpenMPDeclareTargetInitializer(Decl *D)
Adds OMPDeclareTargetDeclAttr to referenced variables in declare target directive.
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
Definition Sema.h:13215
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced.
Definition Sema.h:9522
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
AvailabilityPriority
Describes the kind of priority given to an availability attribute.
Definition Sema.h:3662
@ AP_PragmaClangAttribute
The availability attribute was applied using '#pragma clang attribute'.
Definition Sema.h:3668
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
Definition Sema.h:3672
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
Definition Sema.h:3665
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
Definition Sema.h:3633
@ AMK_None
Don't merge availability attributes at all.
Definition Sema.h:3635
@ AMK_Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition Sema.h:3641
@ AMK_ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
Definition Sema.h:3644
@ AMK_OptionalProtocolImplementation
Merge availability attributes for an implementation of an optional protocol requirement.
Definition Sema.h:3647
@ AMK_Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
Definition Sema.h:3638
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind)
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition Sema.h:864
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
ExprResult BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc)
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, OffsetOfKind OOK, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, const ParsedAttributesView &DeclAttrs, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e....
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition Sema.cpp:2152
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
void ActOnAfterCompoundStatementLeadingPragmas()
Definition SemaStmt.cpp:394
OMPClause * ActOnOpenMPGrainsizeClause(OpenMPGrainsizeClauseModifier Modifier, Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition SemaStmt.cpp:74
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition Sema.h:1161
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
void DiagnoseUnterminatedPragmaAttribute()
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
bool SatisfactionStackContains(const NamedDecl *D, const llvm::FoldingSetNodeID &ID) const
Definition Sema.h:7387
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
LateTemplateParserCB * LateTemplateParser
Definition Sema.h:944
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
StmtResult ActOnOpenMPTargetTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams loop' after parsing of the associated statement.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
QualType getCapturedDeclRefType(ValueDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
void ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD)
Only called on function definitions; if there is a MSVC #pragma optimize in scope,...
LazyVector< CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition Sema.h:916
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Definition Sema.h:880
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition Sema.h:901
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentKind IK)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
bool DeferDiags
Whether deferrable diagnostics should be deferred.
Definition Sema.h:1919
void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init)
Check that the lifetime of the initializer (and its subobjects) is sufficient for initializing the en...
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement.
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
Definition Sema.h:1063
OMPClause * ActOnOpenMPDoacrossClause(OpenMPDoacrossClauseModifier DepType, SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'doacross' clause.
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()
Definition Sema.cpp:76
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition Sema.h:10692
@ RTC_Incompatible
Definition Sema.h:10694
@ RTC_Compatible
Definition Sema.h:10693
@ RTC_Unknown
Definition Sema.h:10695
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
Definition Sema.cpp:2707
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind, SourceLocation Loc)
bool NeedToCaptureVariable(ValueDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
StmtResult ActOnOpenMPErrorDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, bool InExContext=true)
Called on well-formed '#pragma omp error'.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition Sema.h:1422
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
void makeModuleVisible(Module *Mod, SourceLocation ImportLoc)
Definition Sema.h:2401
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary – that is,...
StmtResult ActOnAttributedStmt(const ParsedAttributes &AttrList, Stmt *SubStmt)
Definition SemaStmt.cpp:600
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
QualType BuiltinChangeCVRQualifiers(QualType BaseType, UTTKind UKind, SourceLocation Loc)
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
OMPClause * ActOnOpenMPNumTasksClause(OpenMPNumTasksClauseModifier Modifier, Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
SourceManager & SourceMgr
Definition Sema.h:410
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateNameIsRequiredTag
Definition Sema.h:8075
@ TemplateNameIsRequired
Definition Sema.h:8075
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness,...
bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo, SourceLocation OpLoc, SourceRange R)
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure.
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, CXXScopeSpec &SS, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition SemaAttr.cpp:322
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
bool DiagnoseDependentMemberLookup(const LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
DiagnosticsEngine & Diags
Definition Sema.h:409
CXXMethodDecl * CreateLambdaCallOperator(SourceRange IntroducerRange, CXXRecordDecl *Class)
void DiagnoseUnterminatedPragmaAlignPack()
Definition SemaAttr.cpp:475
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition Sema.h:5067
OpenCLOptions & getOpenCLOptions()
Definition Sema.h:1681
FPOptions CurFPFeatures
Definition Sema.h:403
void ActOnStartSEHFinallyBlock()
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
NamespaceDecl * getStdNamespace() const
QualType BuiltinRemovePointer(QualType BaseType, SourceLocation Loc)
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
void DeclareImplicitEqualityComparison(CXXRecordDecl *RD, FunctionDecl *Spaceship)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition SemaExpr.cpp:516
PragmaStack< StringLiteral * > DataSegStack
Definition Sema.h:693
LazyVector< const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition Sema.h:908
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition Sema.h:945
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
Definition Sema.h:13945
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
@ TUK_Definition
Definition Sema.h:3351
@ TUK_Declaration
Definition Sema.h:3350
@ TUK_Friend
Definition Sema.h:3352
@ TUK_Reference
Definition Sema.h:3349
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition Sema.h:8224
@ TPC_ClassTemplate
Definition Sema.h:8225
@ TPC_FriendFunctionTemplate
Definition Sema.h:8230
@ TPC_ClassTemplateMember
Definition Sema.h:8228
@ TPC_FunctionTemplate
Definition Sema.h:8227
@ TPC_FriendClassTemplate
Definition Sema.h:8229
@ TPC_FriendFunctionTemplateDefinition
Definition Sema.h:8231
@ TPC_TypeAliasTemplate
Definition Sema.h:8232
@ TPC_VarTemplate
Definition Sema.h:8226
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
void ActOnAbortSEHFinallyBlock()
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name,...
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Decl * ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition Sema.h:784
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition Sema.h:878
void DiagnoseUnusedDecl(const NamedDecl *ND)
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
friend class ArgumentPackSubstitutionRAII
Definition Sema.h:9559
bool hasAcceptableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
Determine if the template parameter D has a reachable default argument.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
void PopDeclContext()
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
bool CheckIfFunctionSpecializationIsImmediate(FunctionDecl *FD, SourceLocation Loc)
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition Sema.h:1516
void PrintStats() const
Print out statistics about the semantic analysis.
Definition Sema.cpp:564
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
ExprResult ConvertParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
static unsigned getPrintable(unsigned I)
Definition Sema.h:2211
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
Definition SemaExpr.cpp:987
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
@ FST_NSString
Definition Sema.h:13726
@ FST_Strftime
Definition Sema.h:13727
@ FST_FreeBSDKPrintf
Definition Sema.h:13730
@ FST_Strfmon
Definition Sema.h:13728
@ FST_Kprintf
Definition Sema.h:13729
@ FST_OSTrace
Definition Sema.h:13731
bool checkTargetVersionAttr(SourceLocation LiteralLoc, StringRef &Str, bool &isDefault)
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition Sema.h:433
QualType SubstAutoTypeDependent(QualType TypeWithAuto)
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W)
DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak applied to it,...
QualType CheckSizelessVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
llvm::BumpPtrAllocator BumpAlloc
Definition Sema.h:1493
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
ExprResult ConvertMemberDefaultInitExpression(FieldDecl *FD, Expr *InitExpr, SourceLocation InitLoc)
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddSurrogateCandidate - Adds a "surrogate" candidate function that converts the given Object to a fun...
StmtResult ActOnOpenMPTileDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp tile' after parsing of its clauses and the associated statement.
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
BuildForRangeKind
Definition Sema.h:5172
@ BFRK_Check
Determining whether a for-range statement could be built.
Definition Sema.h:5180
@ BFRK_Build
Initial building of a for-range statement.
Definition Sema.h:5174
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
Definition Sema.h:5177
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
Definition Sema.h:9484
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition Sema.h:416
StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock)
ActOnCXXCatchBlock - Takes an exception declaration and a handler block and creates a proper catch ha...
StmtResult ActOnOpenMPParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel loop' after parsing of the associated statement.
void ActOnPragmaMSStrictGuardStackCheck(SourceLocation PragmaLocation, PragmaMsStackAction Action, bool Value)
ActOnPragmaMSStrictGuardStackCheck - Called on well formed #pragma strict_gs_check.
Definition SemaAttr.cpp:762
void ActOnUninitializedDecl(Decl *dcl)
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
OMPClause * ActOnOpenMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'message' clause.
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
Definition Sema.cpp:2344
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition SemaStmt.cpp:536
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
@ OOK_Outside
Definition Sema.h:3357
@ OOK_Macro
Definition Sema.h:3362
@ OOK_Builtin
Definition Sema.h:3359
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
PragmaSectionKind
Definition Sema.h:10762
@ PSK_ConstSeg
Definition Sema.h:10765
@ PSK_DataSeg
Definition Sema.h:10763
@ PSK_CodeSeg
Definition Sema.h:10766
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement.
void CheckConceptRedefinition(ConceptDecl *NewDecl, LookupResult &Previous, bool &AddToScope)
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
HLSLShaderAttr * mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL, HLSLShaderAttr::ShaderType ShaderType)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Definition Sema.cpp:510
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition Sema.cpp:549
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition SemaCast.cpp:301
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
void ActOnOpenMPAssumesDirective(SourceLocation Loc, OpenMPDirectiveKind DKind, ArrayRef< std::string > Assumptions, bool SkippedClauses)
Called on well-formed '#pragma omp [begin] assume[s]'.
Decl * ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth)
ActOnField - Each field of a C struct/union is passed into this in order to create a FieldDecl object...
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2546
ExprResult ActOnStmtExprResult(ExprResult E)
void EndOpenMPClause()
End analysis of clauses.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
Definition Sema.cpp:93
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
void ActOnCXXForRangeDecl(Decl *D)
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant,...
bool isOpenMPRebuildMemberExpr(ValueDecl *D)
The member expression(this->fd) needs to be rebuilt in the template instantiation to generate private...
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, bool IsTemplateId)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
StmtResult ActOnOpenMPGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp loop' after parsing of the associated statement.
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled)
Called on well formed #pragma clang fp reassociate.
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition Sema.h:1137
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
void CompleteLambdaCallOperator(CXXMethodDecl *Method, SourceLocation LambdaLoc, SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause, TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind, StorageClass SC, ArrayRef< ParmVarDecl * > Params, bool HasExplicitResultType)
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition Sema.h:9920
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
PragmaClangSection PragmaClangBSSSection
Definition Sema.h:468
Decl * ActOnDeclarator(Scope *S, Declarator &D)
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition Sema.h:427
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
AbstractDiagSelID
Definition Sema.h:8023
@ AbstractSynthesizedIvarType
Definition Sema.h:8030
@ AbstractVariableType
Definition Sema.h:8027
@ AbstractReturnType
Definition Sema.h:8025
@ AbstractNone
Definition Sema.h:8024
@ AbstractFieldType
Definition Sema.h:8028
@ AbstractArrayType
Definition Sema.h:8031
@ AbstractParamType
Definition Sema.h:8026
@ AbstractIvarType
Definition Sema.h:8029
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:879
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
PragmaOptionsAlignKind
Definition Sema.h:10705
@ POAK_Packed
Definition Sema.h:10708
@ POAK_Mac68k
Definition Sema.h:10710
@ POAK_Natural
Definition Sema.h:10707
@ POAK_Native
Definition Sema.h:10706
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
void CheckAlignasUnderalignment(Decl *D)
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old)
OMPClause * ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'reverse_offload' clause.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition Sema.h:1172
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition Sema.h:942
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
ObjCSubscriptKind
Definition Sema.h:3993
@ OS_Dictionary
Definition Sema.h:3995
QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind, SourceLocation Loc)
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
SwiftNameAttr * mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
QualType PreferredConditionType(ConditionKind K) const
Definition Sema.h:12975
ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, SourceLocation RangeLoc, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
Build a call to 'begin' or 'end' for a C++11 for-range statement.
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition Sema.h:10572
@ ObjCSuperMessage
The message is sent to 'super'.
Definition Sema.h:10574
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition Sema.h:10579
@ ObjCInstanceMessage
The message is an instance message.
Definition Sema.h:10576
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition Sema.h:4414
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
Definition Sema.h:4418
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition Sema.h:4424
@ LOLR_Error
The lookup resulted in an error.
Definition Sema.h:4416
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition Sema.h:4421
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition Sema.h:4432
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition Sema.h:4428
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition Sema.cpp:2332
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Definition Sema.h:13112
llvm::function_ref< void(SourceLocation Loc, PartialDiagnostic PD)> DiagReceiverTy
Definition Sema.h:5340
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
StmtResult ActOnOpenMPMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop' after parsing of the associated statement.
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const NamedDecl *New, const Expr *NewConstr)
CheckConstexprKind
Definition Sema.h:2982
@ CheckValid
Identify whether this function satisfies the formal rules for constexpr functions in the current lanu...
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CheckVariableDeclarationType(VarDecl *NewVD)
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition SemaStmt.cpp:406
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition Sema.cpp:2699
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
Definition Sema.cpp:502
DelayedDiagnosticsState ProcessingContextState
Definition Sema.h:963
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
CXXSpecialMember
Kinds of C++ special members.
Definition Sema.h:1567
@ CXXCopyConstructor
Definition Sema.h:1569
@ CXXMoveConstructor
Definition Sema.h:1570
@ CXXDestructor
Definition Sema.h:1573
@ CXXDefaultConstructor
Definition Sema.h:1568
@ CXXInvalid
Definition Sema.h:1574
@ CXXMoveAssignment
Definition Sema.h:1572
@ CXXCopyAssignment
Definition Sema.h:1571
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
std::optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, unsigned NumAppendArgs, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition Sema.cpp:587
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition Sema.h:1229
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition Sema.h:1607
void ActOnFinishOfCompoundStmt()
Definition SemaStmt.cpp:402
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[]{ return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, Scope *CurScope)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
ObjCSpecialMethodKind
Definition Sema.h:10508
@ OSMK_NonRetainingInit
Definition Sema.h:10514
@ OSMK_RetainingInit
Definition Sema.h:10513
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2568
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
static ConditionResult ConditionError()
Definition Sema.h:12968
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition SemaStmt.cpp:410
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={}, OverloadCandidateParamOrder PO={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
void ActOnStartTrailingRequiresClause(Scope *S, Declarator &D)
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop' after parsing of the associated statemen...
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
AttributeCompletion
Definition Sema.h:13412
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
IdentifierResolver IdResolver
Definition Sema.h:1156
DeclResult ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const
Determine whether the token kind starts a simple-type-specifier.
Definition SemaDecl.cpp:129
TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)
Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition Sema.h:9480
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement.
bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, bool AllowMask) const
IsValueInFlagEnum - Determine if a value is allowed as part of a flag enum.
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition Sema.cpp:2293
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition SemaStmt.cpp:554
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
Definition Sema.h:830
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
FullExprArg MakeFullExpr(Expr *Arg)
Definition Sema.h:5060
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition Sema.h:398
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition SemaDecl.cpp:721
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
Definition Sema.h:1564
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition Sema.h:1196
static int getPrintable(int I)
Definition Sema.h:2210
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition SemaAttr.cpp:773
bool hasReachableDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is reachable.
Definition Sema.h:2434
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition Sema.h:9274
OMPRequiresDecl * CheckOMPRequiresDecl(SourceLocation Loc, ArrayRef< OMPClause * > Clauses)
Check restrictions on Requires directive.
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition SemaStmt.cpp:541
ObjCContainerKind getObjCContainerKind() const
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition Sema.h:2868
bool CheckAltivecInitFromScalar(SourceRange R, QualType VecTy, QualType SrcTy)
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
static const std::string & getPrintable(const std::string &S)
Definition Sema.h:2215
PragmaClangSectionKind
pragma clang section kind
Definition Sema.h:448
@ PCSK_Invalid
Definition Sema.h:449
@ PCSK_BSS
Definition Sema.h:450
@ PCSK_Data
Definition Sema.h:451
@ PCSK_Text
Definition Sema.h:453
@ PCSK_Relro
Definition Sema.h:454
@ PCSK_Rodata
Definition Sema.h:452
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
void warnOnReservedIdentifier(const NamedDecl *D)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
Definition SemaStmt.cpp:511
bool isCheckingDefaultArgumentOrInitializer() const
Definition Sema.h:9809
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined.
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=std::nullopt)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
StmtResult ActOnOpenMPTargetDataDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target data' after parsing of the associated statement.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
static const char * getPrintable(const char *S)
Definition Sema.h:2213
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=std::nullopt)
Called on well-formed 'from' clause.
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, OverloadCandidateParamOrder PO={})
Add overload candidates for overloaded operators that are member functions.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
AllocationFunctionScope
The scope in which to find allocation functions.
Definition Sema.h:6827
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
Definition Sema.h:6835
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
Definition Sema.h:6832
@ AFS_Global
Only look for allocation functions in the global scope.
Definition Sema.h:6829
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
bool isAbstractType(SourceLocation Loc, QualType T)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr, bool SkipImmediateInvocations=true)
Instantiate or parse a C++ default argument expression as necessary.
ASTMutationListener * getASTMutationListener() const
Definition Sema.cpp:540
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
PragmaMsStackAction
Definition Sema.h:474
@ PSK_Push_Set
Definition Sema.h:480
@ PSK_Reset
Definition Sema.h:475
@ PSK_Pop_Set
Definition Sema.h:481
@ PSK_Show
Definition Sema.h:479
@ PSK_Pop
Definition Sema.h:478
@ PSK_Set
Definition Sema.h:476
@ PSK_Push
Definition Sema.h:477
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called once a target context is completed, that can be when a '#pragma omp end declare target' was en...
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
void DiagnoseImmediateEscalatingReason(FunctionDecl *FD)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Definition Sema.h:6953
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals, bool EvaluateConstraints=true)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
OMPClause * ActOnOpenMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'relaxed' clause.
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
unsigned getHashValue() const
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition Overload.h:261
Stmt - This represents one statement.
Definition Stmt.h:72
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:325
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1793
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2209
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3469
Exposes information about the current target.
Definition TargetInfo.h:207
A convenient class for passing around template argument information.
A template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
This is a base class for callbacks that will be notified at every template instantiation.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Token - This structure provides full information about a lexed token.
Definition Token.h:35
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3441
Represents a declaration of a type.
Definition Decl.h:3277
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:58
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition TypeLoc.h:152
A container of type source information.
Definition Type.h:6655
The base class of the type hierarchy.
Definition Type.h:1577
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3421
Base class for declarations which introduce a typedef-name.
Definition Decl.h:3319
Simple class containing the result of Sema::CorrectTypo.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition Expr.h:6550
Represents a C++ unqualified-id that has been parsed.
Definition DeclSpec.h:989
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3159
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:3897
A set of unresolved declarations.
The iterator over UnresolvedSets.
Represents a C++ using-declaration.
Definition DeclCXX.h:3466
Represents C++ using-directive.
Definition DeclCXX.h:2969
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3274
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:701
Represents a variable declaration or definition.
Definition Decl.h:913
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a GCC generic vector type.
Definition Type.h:3409
Represents a C++11 virt-specifier-seq.
Definition DeclSpec.h:2696
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition Lookup.h:799
A set of visible modules.
Definition Module.h:770
Captures information about a #pragma weak directive.
Definition Weak.h:25
A requires-expression requirement which queries the validity and properties of an expression ('simple...
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
A declaration being accessed, together with information about how it was accessed.
Retains information about a block that is currently being parsed.
Definition ScopeInfo.h:759
Retains information about a captured region.
Definition ScopeInfo.h:785
Contains information about the compound statement currently being parsed.
Definition ScopeInfo.h:67
A collection of diagnostics which were delayed.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:102
Provides information about an attempted template argument deduction, whose success or failure was des...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
void threadSafetyCleanup(BeforeSet *Cache)
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition TokenKinds.h:25
TypeSpecifierType
Specifies the kind of type.
Definition Specifiers.h:55
ImplicitTypenameContext
Definition DeclSpec.h:1833
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
Definition Address.h:155
ArrayTypeTrait
Names for the array type traits.
Definition TypeTraits.h:42
@ CPlusPlus
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
Definition Ownership.h:276
CanThrowResult
Possible results from evaluation of a noexcept expression.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
OpenMPOrderClauseModifier
OpenMP modifiers for 'order' clause.
PragmaMSCommentKind
Definition PragmaKinds.h:14
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition Specifiers.h:35
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
Definition Specifiers.h:39
ObjCPropertyQueryKind
Definition DeclObjC.h:717
NullabilityKind
Describes the nullability of a particular type.
Definition Specifiers.h:323
InClassInitStyle
In-class initialization styles for non-static data members.
Definition Specifiers.h:262
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:140
OpenMPAtClauseKind
OpenMP attributes for 'at' clause.
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition Overload.h:84
std::unique_ptr< sema::RISCVIntrinsicManager > CreateRISCVIntrinsicManager(Sema &S)
TypeOfKind
The kind of 'typeof' expression we're after.
Definition Type.h:717
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
Definition CallGraph.h:207
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition OpenMPKinds.h:38
ActionResult< Decl * > DeclResult
Definition Ownership.h:268
CapturedRegionKind
The different kinds of captured statement.
StorageClass
Storage classes.
Definition Specifiers.h:239
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Expr * Cond
};
TypeResult TypeError()
Definition Ownership.h:280
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition Overload.h:819
OpenMPDoacrossClauseModifier
OpenMP dependence types for 'doacross' clause.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition TypeTraits.h:51
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition Overload.h:89
LambdaCaptureInitKind
Definition DeclSpec.h:2740
@ CopyInit
[a = b], [a = {b}]
@ Result
The result type of a method or function.
ActionResult< ParsedType > TypeResult
Definition Ownership.h:264
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ActionResult< CXXCtorInitializer * > MemInitResult
Definition Ownership.h:266
ParameterABI
Kinds of parameter ABI.
Definition Specifiers.h:353
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition OpenMPKinds.h:54
OpenMPGrainsizeClauseModifier
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition LangOptions.h:55
OpenMPNumTasksClauseModifier
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
OpenMPSeverityClauseKind
OpenMP attributes for 'severity' clause.
LangAS
Defines the address space values used by the address space qualifier of QualType.
CastKind
CastKind - The kind of operation required for a conversion.
TranslationUnitKind
Describes the kind of translation unit being processed.
@ TU_Complete
The translation unit is a complete translation unit.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
ComparisonCategoryType
An enumeration representing the different comparison categories types.
PragmaMSStructKind
Definition PragmaKinds.h:23
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition OpenMPKinds.h:62
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
@ TNK_Concept_template
The name refers to a concept.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:24
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition Lambda.h:22
PragmaFloatControlKind
Definition PragmaKinds.h:28
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:123
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition Specifiers.h:126
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition Expr.h:61
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition Specifiers.h:379
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
TPOC
The context in which partial ordering of function templates occurs.
Definition Template.h:296
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition Sema.h:243
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition Specifiers.h:179
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition Specifiers.h:269
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition DeclObjC.h:554
U cast(CodeGen::Address addr)
Definition Address.h:152
@ None
The alignment was not explicit in code.
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition OpenMPKinds.h:47
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition Ownership.h:243
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition OpenMPKinds.h:27
ActionResult< Expr * > ExprResult
Definition Ownership.h:262
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
Definition TypeTraits.h:21
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition OpenMPKinds.h:30
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:114
@ AS_none
Definition Specifiers.h:118
ActionResult< Stmt * > StmtResult
Definition Ownership.h:263
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition OpenMPKinds.h:70
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition Specifiers.h:164
YAML serialization mapping.
Definition Dominators.h:30
Definition Format.h:5008
#define true
Definition stdbool.h:21
#define false
Definition stdbool.h:22
#define bool
Definition stdbool.h:20
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:86
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition DeclSpec.h:1290
A structure used to record information about a failed template argument deduction,...
This little struct is used to capture information about structure field declarators,...
Definition DeclSpec.h:2686
Describes whether we've seen any nullability information for the given file.
Definition Sema.h:247
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
Definition Sema.h:254
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition Sema.h:250
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition Sema.h:260
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition Sema.h:257
Holds information about the various types of exception specification.
Definition Type.h:4127
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition Type.h:4129
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition Type.h:4132
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition Type.h:4135
Extra information about a function prototype.
Definition Type.h:4153
Wraps an identifier and optional source location for the identifier.
Definition ParsedAttr.h:97
Represents a complete lambda introducer.
Definition DeclSpec.h:2748
Contains a late templated function.
Definition Sema.h:14063
FPOptions FPO
Floating-point options in the point of definition.
Definition Sema.h:14068
Decl * D
The template function declaration to be late parsed.
Definition Sema.h:14066
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
Definition SemaConcept.h:81
Iterator range representation begin:end[:step].
Definition ExprOpenMP.h:278
This structure contains most locations needed for by an OMPVarListClause.
a linked list of methods with the same selector name but different signatures.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:823
Describes how types, statements, expressions, and declarations should be printed.
SourceLocation CurrentPragmaLocation
Definition Sema.h:688
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition Sema.h:9298
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition Sema.h:9456
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition Sema.h:9409
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition Sema.h:9425
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition Sema.h:9451
ArrayRef< TemplateArgument > template_arguments() const
Definition Sema.h:9444
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation,...
Definition Sema.h:9420
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition Sema.h:9412
unsigned NumCallArgs
The number of expressions in CallArgs.
Definition Sema.h:9438
const Expr *const * CallArgs
The list of argument expressions in a synthesized call.
Definition Sema.h:9428
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition Sema.h:9435
SynthesisKind
The kind of template instantiation we are performing.
Definition Sema.h:9300
@ MarkingClassDllexported
We are marking a class as __dllexport.
Definition Sema.h:9392
@ DefaultTemplateArgumentInstantiation
We are instantiating a default argument for a template parameter.
Definition Sema.h:9310
@ ExplicitTemplateArgumentSubstitution
We are substituting explicit template arguments provided for a function template.
Definition Sema.h:9319
@ DefaultTemplateArgumentChecking
We are checking the validity of a default template argument that has been used when naming a template...
Definition Sema.h:9338
@ InitializingStructuredBinding
We are initializing a structured binding.
Definition Sema.h:9389
@ ExceptionSpecInstantiation
We are instantiating the exception specification for a function template which was deferred until it ...
Definition Sema.h:9346
@ NestedRequirementConstraintsCheck
We are checking the satisfaction of a nested requirement of a requires expression.
Definition Sema.h:9353
@ BuildingBuiltinDumpStructCall
We are building an implied call from __builtin_dump_struct.
Definition Sema.h:9396
@ DefiningSynthesizedFunction
We are defining a synthesized function (such as a defaulted special member).
Definition Sema.h:9364
@ Memoization
Added for Template instantiation observation.
Definition Sema.h:9402
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Definition Sema.h:9329
@ BuildingDeductionGuides
We are building deduction guides for a class.
Definition Sema.h:9405
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
Definition Sema.h:9326
@ PriorTemplateArgumentSubstitution
We are substituting prior template arguments into a new template parameter.
Definition Sema.h:9334
@ ExceptionSpecEvaluation
We are computing the exception specification for a defaulted special member function.
Definition Sema.h:9342
@ TemplateInstantiation
We are instantiating a template declaration.
Definition Sema.h:9303
@ DeclaringSpecialMember
We are declaring an implicit special member function.
Definition Sema.h:9356
@ DeclaringImplicitEqualityComparison
We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.
Definition Sema.h:9360
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Definition Sema.h:9315
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Definition Sema.h:9386
@ RequirementInstantiation
We are instantiating a requirement of a requires expression.
Definition Sema.h:9349
CXXSpecialMember SpecialMember
The special member being declared or defined.
Definition Sema.h:9441
Decl * Entity
The entity that is being synthesized.
Definition Sema.h:9415
bool isInstantiationRecord() const
Determines whether this template is an actual instantiation that should be counted toward the maximum...
OMPDeclareTargetDeclAttr::MapTypeTy MT
Definition Sema.h:11061
InitializationContext(SourceLocation Loc, ValueDecl *Decl, DeclContext *Context)
Definition Sema.h:1364
Data structure used to record current or nested expression evaluation contexts.
Definition Sema.h:1297
SmallVector< CXXBindTemporaryExpr *, 8 > DelayedDecltypeBinds
If we are processing a decltype type, a set of temporary binding expressions for which we have deferr...
Definition Sema.h:1329
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
Definition Sema.h:1336
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
Definition Sema.h:1331
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition Sema.h:1321
SmallVector< CallExpr *, 8 > DelayedDecltypeCalls
If we are processing a decltype type, a set of call expressions for which we have deferred checking t...
Definition Sema.h:1325
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
Definition Sema.h:1343
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
Definition Sema.h:1339
enum clang::Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition Sema.h:1316
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
Definition Sema.h:1347
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition Sema.h:1302
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition Sema.h:1310
std::optional< InitializationContext > DelayedDefaultInitializationContext
Definition Sema.h:1374
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, ExpressionKind ExprContext)
Definition Sema.h:1376
ExpressionEvaluationContext Context
The expression evaluation context.
Definition Sema.h:1299
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition Sema.h:1306
FormatArgumentPassingKind ArgPassingKind
Definition Sema.h:13554
A pair of a canonical FunctionDecl and a SourceLocation.
Definition Sema.h:13095
CanonicalDeclPtr< const FunctionDecl > FD
Definition Sema.h:13096
An RAII helper that pops function a function scope on exit.
Definition Sema.h:5102
A stack object to be created when performing template instantiation.
Definition Sema.h:9581
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition Sema.h:9732
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, Decl *Entity, SourceRange InstantiationRange=SourceRange())
Note that we are instantiating a class template, function template, variable template,...
void Clear()
Note that we have finished instantiating this template.
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition Sema.h:9736
LocalInstantiationScope * Scope
Definition Sema.h:10189
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition Sema.h:10192
bool isMoveEligible() const
Definition Sema.h:5229
bool isCopyElidable() const
Definition Sema.h:5230
const VarDecl * Candidate
Definition Sema.h:5224
Keeps information about an identifier in a nested-name-spec.
Definition Sema.h:7003
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition Sema.h:7009
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition Sema.h:7018
SourceLocation IdentifierLoc
The location of the identifier.
Definition Sema.h:7012
SourceLocation CCLoc
The location of the '::'.
Definition Sema.h:7015
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
Definition Sema.h:7006
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition Sema.h:7024
Data structure for iterator expression.
Definition Sema.h:5827
OMPIteratorExpr::IteratorRange Range
Definition Sema.h:5831
SourceLocation DeclIdentLoc
Definition Sema.h:5829
IdentifierInfo * DeclIdent
Definition Sema.h:5828
SourceLocation AssignLoc
Definition Sema.h:5832
SourceLocation ColonLoc
Definition Sema.h:5833
SourceLocation SecColonLoc
Definition Sema.h:5834
IdentifierInfo * Name
Definition Sema.h:10518
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition Sema.h:10526
ObjCDeclSpec DeclSpec
Definition Sema.h:10523
SourceLocation NameLoc
Definition Sema.h:10519
SourceLocation LocStart
Definition Sema.h:6030
IdentifierInfo * IdentInfo
Definition Sema.h:6033
union clang::Sema::OffsetOfComponent::@238 U
Data used for processing a list of variables in OpenMP clauses.
Definition Sema.h:12115
CXXScopeSpec ReductionOrMapperIdScopeSpec
Definition Sema.h:12120
SmallVector< OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers > MapTypeModifiers
Definition Sema.h:12125
SmallVector< OpenMPMotionModifierKind, NumberOfOMPMotionModifiers > MotionModifiers
Definition Sema.h:12129
SourceLocation ExtraModifierLoc
Definition Sema.h:12132
DeclarationNameInfo ReductionOrMapperId
Definition Sema.h:12121
SmallVector< SourceLocation, NumberOfOMPMotionModifiers > MotionModifiersLoc
Definition Sema.h:12130
SourceLocation OmpAllMemoryLoc
Definition Sema.h:12133
SmallVector< SourceLocation, NumberOfOMPMapClauseModifiers > MapTypeModifiersLoc
Definition Sema.h:12127
int ExtraModifier
Additional modifier for linear, map, depend or lastprivate clause.
Definition Sema.h:12122
brief A function argument from which we performed template argument
Definition Sema.h:9127
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition Sema.h:9128
This an attribute introduced by #pragma clang attribute.
Definition Sema.h:759
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition Sema.h:762
A push'd group of PragmaAttributeEntries.
Definition Sema.h:767
SourceLocation Loc
The location of the push attribute.
Definition Sema.h:769
SmallVector< PragmaAttributeEntry, 2 > Entries
Definition Sema.h:772
const IdentifierInfo * Namespace
The namespace of this push group.
Definition Sema.h:771
SourceLocation PragmaLocation
Definition Sema.h:465
PragmaMsStackAction Action
Definition Sema.h:485
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
Definition Sema.h:599
llvm::StringRef StackSlotLabel
Definition Sema.h:595
SourceLocation PragmaLocation
Definition Sema.h:597
SourceLocation PragmaPushLocation
Definition Sema.h:598
ValueType CurrentValue
Definition Sema.h:669
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition Sema.h:655
bool hasValue() const
Definition Sema.h:665
SmallVector< Slot, 2 > Stack
Definition Sema.h:667
ValueType DefaultValue
Definition Sema.h:668
SourceLocation CurrentPragmaLocation
Definition Sema.h:670
PragmaStack(const ValueType &Default)
Definition Sema.h:662
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition Sema.h:606
ProcessDeclAttributeOptions WithIgnoreTypeAttributes(bool Val)
Definition Sema.h:4701
ProcessDeclAttributeOptions WithIncludeCXX11Attributes(bool Val)
Definition Sema.h:4695
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Definition Sema.h:12817
NamedDecl * Previous
Definition Sema.h:2629
Abstract class used to diagnose incomplete types.
Definition Sema.h:2203
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition Sema.h:13824
unsigned LayoutCompatible
If true, Type should be compared with other expression's types for layout-compatibility.
Definition Sema.h:13833
Data for list of allocators.
Definition Sema.h:12309
Expr * Allocator
Allocator.
Definition Sema.h:12311
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Definition Sema.h:12315
Expr * AllocatorTraits
Allocator traits.
Definition Sema.h:12313
Information about a template-id annotation token.
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
Definition Sema.h:14102
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
Definition Sema.h:14097
DenseMapInfo< clang::CanonicalDeclPtr< const clang::FunctionDecl > > FDBaseInfo
Definition Sema.h:14086